-
-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Messange order #67
Comments
Do you have any ideas that can help enforce the synchronous in a scenario like this? |
I did create a prototype of this using an external database (reddis) to store all send messages. With the recieve events in the webhook I delete from the database. Before sending a new message I check in the database if there are open messages for that phone number. For now it is not a pretty solution but it might be helpful also for other people. And can hopefully be improved by the community :) |
I suggest you to do an if statement with the response code of the previous sent message, e.g.: msg1 = client.send_image("1.jpg", to="xxx")
try: msg1["error"]
except: msg2 = . . . Didn't test this, but it should work. |
Hi @filipporomani, |
I know that. The issue is that the send_image() function returns the request json, so the only way to wait is to check the json content. |
When you send a message using the cloud api, your webhook receives 2 requests:
To ensure that messages are sent in order, you first have to check the status of the previous message. If the message was "delivered", then you can proceed to send the second message. |
Hi everyone,
I know this is not a problem with heyoo, but maybe it should/cpuld be something to be delt with here. I experience wrong message order on the recieving side of the chatbot when sending several messages directly after one antoher. This happens especially when sending images.
When sending thre images (1.jpg, 2jpg, 3.jpg)
This might result in receiving the images in a different order (1,3,2 or 3,1,2)
Do you have a good way already to change this asynchronous behaviour of the WhatsApp Cloud API? Would this the something of interest for this API?
Best,
Sören
The text was updated successfully, but these errors were encountered: