venomous0x / WhatsAPI

Interface to WhatsApp Messenger
2.59k stars 2.13k forks source link

Doubt about Contact Synchronization #762

Open RodrigoRVieira opened 10 years ago

RodrigoRVieira commented 10 years ago

Hi everyone!

Anyone know if I need to call the method with all my contacts every single time or it can be called incrementally?

Thank you

shirioko commented 10 years ago

You can use mode="delta" and send them incrementally. If you use it too often it will return an error node with a "backoff" time.

RodrigoRVieira commented 10 years ago

Got it! Thank you

Two more questions... what exactly this synchronization process does? What triggers synchronization in the official client?

shirioko commented 10 years ago

From what I understand:

I still owe you a complete answer for this, I'll check out the sources I have when I get home.

RodrigoRVieira commented 10 years ago

Thank you

faisalcse commented 10 years ago

Contact Synch not working

mgp25 commented 10 years ago

@faisalcse Its working perfectly, post output/script or error description

faisalcse commented 10 years ago

I am not getting any error. It keeps waiting and waiting but nothing come result.

Marcorele commented 10 years ago

@faisalcse You have reach the limit...

faisalcse commented 10 years ago

what limit?

Marcorele commented 10 years ago

You can't sync unlimited contacts with same username and password.

When you reach the limit, it keeps waiting without any result...

faisalcse commented 10 years ago

OK. what is the maximum # number of contacts I can synchronize with same username and password? Another question, is there any days limit like with 24 hours I can synchronize maximum # number of contacts?

mgp25 commented 10 years ago

@shirioko as @McBacker asked, what exactly this synchronization process does? What triggers synchronization in the official client?

thanks

CodersBrothers commented 10 years ago

What is and make $index = 0, $last = true in

 public function sendSync(array $numbers, $mode = "full", $context = "registration", $index = 0, $last = true)
mpbanna commented 10 years ago

Hi everyone, i have found a new problem that sendSync method allows only one synchronize per hour, means backoff time is set 60 minute after one try of sendSync method . And i have also tried with all 3 arguments that are

mode="full"&context="registration" mode="full"&context="background" mode="delta"&context="background"

but it allow only one time per hour , and i surprised that i changed mode="abc"&context="abc" , than it also allow me synchronize one time per hour.

please help me Thanks

mgp25 commented 10 years ago

The backoff time is something server side, it wont allow you to sendSync multiple times. No fix.

mpbanna commented 10 years ago

But according to @shirioko, context="background" allows 4 times per hour and context="registration" allows 50 times per hour ,than what does it mean and according to @mgp25 ,before sending each message we have to use sendSync method to stop blocking ,than how it is possible if sendSync not allows multiple time ???

please give me proper solution to this problem.

mgp25 commented 10 years ago

sendSync is just a function to import your contacts from Adress Book (contact list) to WhatsApp contact list. So only the ones who has WhatsApp appear in your WhatsApp contact list. You should sendSync only at the start of the App or when adding a new contact. There isnt required to sendSync multiple times, just makes no sense. Also sometimes when you have WhatsApp running at background it sendSync to check if is there any contact to add to WhatsApp contact list.

If you send messages to random / semi random users or just send messages (spam) you will be blocked and there is no way to avoid that. It's easy.

ankurextreme commented 9 years ago

please explain a bit. while using sendSync(array (a,b)) say contacts a &b , so does it mean only a,b contacts are in address book ? if we do next time sendSync(array (c,d)) does it mean contact a & b is deleted from my phone? is it possible to get all contacts with are LINKED to my account ? or is it that only the contacts i sync are every time only that are linked, in this case only c,d and not a,b ?

i have a small site which sends welcome message on customer registration. so when a new customer arrives, do i have to sync only his contact or ALL the contact to which i sent message before ? after sync wen i call onSyncResult($result) like in example in your repo if it exist then i send a message.

what is the best solution to my problem ? site flow required for = registration -> check if available on whatsapp by sync(this particular number ) -> if onSyncResult($result) and $result->existing then send a welcome message.