Skip to content
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

Whatsapp messages cannot be received although no error message pops up as output #40

Open
emre84 opened this issue Nov 3, 2022 · 22 comments

Comments

@emre84
Copy link

emre84 commented Nov 3, 2022

Environment:
MACOS Monterey
Python:3.7.3
heyoo:0.0.6 (pip)

Code:
from heyoo import WhatsApp
messenger = WhatsApp('xxx',phone_number_id='xxx')
messenger.send_message('Hello I am WhatsApp Cloud API', '49xxx')

Output:
2022-11-03 22:51:34,464 - root - INFO - Sending message to 49xxx
2022-11-03 22:51:35,200 - root - INFO - Message sent to 49xxx

Description:
Although my Facebook WhatsApp setting are done properly(Test message from Facebook Website can be sent properly). The WhatsApp message cannot be sent via heyoo. (No error message is received from python)

Note:I am sure that my token number, phone_number_id and recipient_id number are correct, with the reason that if I write anything wrong in these fields, I get following error message.:

2022-11-03 23:03:01,945 - root - INFO - Status code: 400
2022-11-03 23:03:01,945 - root - INFO - Response: {'error': {'message': '(#131030) Recipient phone number not in allowed list', 'type': 'OAuthException', 'code': 131030, 'error_data': {'messaging_product': 'whatsapp', 'details': 'Empfänger-Telefonnummer steht nicht auf Positivliste: Füge die Telefonnummer des Empfängers zu einer Empfängerliste hinzu und versuche es dann noch einmal.'}, 'error_subcode': 2655007, 'fbtrace_id': 'Akf6LRk1j9htPAuzA5P971E'}}

@emre84 emre84 changed the title Message cannot be sent although no error message pope up Whatsapp message cannot be received although no error message pops up as output Nov 3, 2022
@emre84 emre84 changed the title Whatsapp message cannot be received although no error message pops up as output Whatsapp messages cannot be received although no error message pops up as output Nov 3, 2022
@Kalebu
Copy link
Contributor

Kalebu commented Nov 8, 2022

Hi @emre84 Can you please share the response message in English ?

@emre84
Copy link
Author

emre84 commented Nov 8, 2022

Hi Kalebu,

thanks for the response. This is unfortunately what i get as response(nothingelse as imentiined above)

Output:
2022-11-03 22:51:34,464 - root - INFO - Sending message to 49xxx
2022-11-03 22:51:35,200 - root - INFO - Message sent to 49xxx

@Mattia921
Copy link

Hi Kalebu,

thanks for the response. This is unfortunately what i get as response(nothingelse as imentiined above)

Output: 2022-11-03 22:51:34,464 - root - INFO - Sending message to 49xxx 2022-11-03 22:51:35,200 - root - INFO - Message sent to 49xxx

I have exactly the same problem. Thanks in advance for your time

@Kalebu
Copy link
Contributor

Kalebu commented Nov 9, 2022

Hi @emre84 and @Mattia921 just know you cannot send other messages other than <template_message> to un whitelisted numbers, To able to do this you need to add the number to the recipient list in your Facebook developer portal.

The error translates to

{'error': {'message': '(#131030) Recipient phone number not in allowed list', 'type': 'OAuthException', 'code': 131030, 'error_data': {'messaging_product': 'whatsapp' , 'details': 'Recipient's phone number is not whitelisted: add the recipient's phone number to a recipient list, then try again.'}, 'error_subcode': 2655007, 'fbtrace_id': 'Akf6LRk1j9htPAuzA5P971E'}}

They Allow up to 5 test numbers which you cannot change

Please let me know if you're still having issues

@Mattia921
Copy link

Mattia921 commented Nov 9, 2022

Hi @Kalebu, thanks for your response. The fact is that I do not receive any errors while executing the python code.
This is the output:

2022-11-09 10:49:39,296 - root - INFO - Sending message to 39333***
2022-11-09 10:49:40,604 - root - INFO - Message sent to 39333***

So the code is executed without errors, but I don't actually receive anything on the whatsapp number.
I've already added the receiver into the recipient list inside the Facebook developer portal.
Can be this problem related to the country prefix number? In my case, I've entered the Italian code without the + (so only 39).
I hope I was clear.
Thanks again for your time. Have a nice day

@Kalebu
Copy link
Contributor

Kalebu commented Nov 9, 2022

Hi @Mattia921

Can you run this and let me know if you're able to receive a message?

>>> messenger.send_template("hello_world", "255757xxxxxx", components={})

@emre84
Copy link
Author

emre84 commented Nov 9, 2022

Hi @emre84 and @Mattia921 just know you cannot send other messages other than <template_message> to un whitelisted numbers, To able to do this you need to add the number to the recipient list in your Facebook developer portal.

The error translates to

{'error': {'message': '(#131030) Recipient phone number not in allowed list', 'type': 'OAuthException', 'code': 131030, 'error_data': {'messaging_product': 'whatsapp' , 'details': 'Recipient's phone number is not whitelisted: add the recipient's phone number to a recipient list, then try again.'}, 'error_subcode': 2655007, 'fbtrace_id': 'Akf6LRk1j9htPAuzA5P971E'}}

They Allow up to 5 test numbers which you cannot change

Please let me know if you're still having issues

I added also in the recipient list in your Facebook developer portal.

Note:I am sure that my token number, phone_number_id and recipient_id number are correct, with the reason that if I write anything wrong in these fields, I get following error message.:

2022-11-03 23:03:01,945 - root - INFO - Status code: 400
2022-11-03 23:03:01,945 - root - INFO - Response: {'error': {'message': '(#131030) Recipient phone number not in allowed list', 'type': 'OAuthException', 'code': 131030, 'error_data': {'messaging_product': 'whatsapp', 'details': 'Empfänger-Telefonnummer steht nicht auf Positivliste: Füge die Telefonnummer des Empfängers zu einer Empfängerliste hinzu und versuche es dann noch einmal.'}, 'error_subcode': 2655007, 'fbtrace_id': 'Akf6LRk1j9htPAuzA5P971E'}}

@Mattia921
Copy link

Hi @Mattia921

Can you run this and let me know if you're able to receive a message?

>>> messenger.send_template("hello_world", "255757xxxxxx", components={})

Hi @Kalebu, in this case I'am able to receive the message. So since I would like to use the library to upload and then download images, should I always use the send_template method?

Thanks again for your help

@Mattia921
Copy link

Hi Kalebu,

This is my output. messenger.send_template("hello_world", "49xxx", components={}) 2022-11-09 15:37:06,533 - root - INFO - Sending template to 49xxx 2022-11-09 15:37:07,003 - root - INFO - Template not sent to 49xxx 2022-11-09 15:37:07,003 - root - INFO - Status code: 401 2022-11-09 15:37:07,003 - root - INFO - Response: {'error': {'message': 'Error validating access token: Session has expired on Friday, 04-Nov-22 14:00:00 PDT. The current time is Wednesday, 09-Nov-22 06:37:06 PST.', 'type': 'OAuthException', 'code': 190, 'error_subcode': 463, 'fbtrace_id': 'A4QGvLtyY9xP-QVKPYRWMjX'}}

Note:I tried also +49xxx, 0049xxx, but none of them worked.

Since the access token updates every 24 hours, did you use the new one?

@soerenetler
Copy link
Collaborator

I had many similar problems in the beginning and It just got solved with a new Facebook Business Profile.
As far as I see this is not a issue with the heyoo library. Does it work to send the same messege in e.g. Postman?

@Mattia921
Copy link

I had many similar problems in the beginning and It just got solved with a new Facebook Business Profile. As far as I see this is not a issue with the heyoo library. Does it work to send the same messege in e.g. Postman?

Hi @soerenetler, I've just tried with postman and I obtain the same result.
If I use the "type"="template" everything works fine, as with the wrapper of the heyoo library. On the other hand, with the "type"="text" (equivalent to the heyoo method send_message), the API call works but I don't receive anything on the WhatsApp number.

I will try with a new Facebook Business profile as you suggest. Thanks

@Mattia921
Copy link

I had many similar problems in the beginning and It just got solved with a new Facebook Business Profile. As far as I see this is not a issue with the heyoo library. Does it work to send the same messege in e.g. Postman?

Hi @soerenetler, I've just tried with postman and I obtain the same result. If I use the "type"="template" everything works fine, as with the wrapper of the heyoo library. On the other hand, with the "type"="text" (equivalent to the heyoo method send_message), the API call works but I don't receive anything on the WhatsApp number.

I will try with a new Facebook Business profile as you suggest. Thanks

I've tried with a new Business profile but I could not solve the problem

@SrVitinho
Copy link

I'm currently having the exact same problem, I've done all steps and still no message

@orkunozturk
Copy link

@emre84

Currently, customers in Turkey cannot receive messages sent by businesses using Cloud API. However, businesses in Turkey are still able to send messages using the Cloud API.

https://developers.facebook.com/docs/whatsapp/cloud-api/support/troubleshooting#message-not-delivered

@elimardom
Copy link

Hi @Mattia921

Can you run this and let me know if you're able to receive a message?

>>> messenger.send_template("hello_world", "255757xxxxxx", components={})

this way works for me, any other method doesn't give any error but doesn't send anything either.

@Kalebu
Copy link
Contributor

Kalebu commented Dec 15, 2022

Hi @Mattia921
Can you run this and let me know if you're able to receive a message?

>>> messenger.send_template("hello_world", "255757xxxxxx", components={})

this way works for me, any other method doesn't give any error but doesn't send anything either.

Did you add your number as one of the test numbers to the Facebook developer portal?

You could also try replying first to the number before sending any other message other than the template message

@emre84
Copy link
Author

emre84 commented Dec 17, 2022

Hi,

Thanks for the response. Following code works fine for me either:

messenger.send_template("hello_world", "255757xxxxxx", components={})

But I can just send template messages with this command.
isn't it possible to use messenger.send_message? I do not want to use any templates.

@germor24
Copy link

germor24 commented Jan 13, 2023

Hi @Mattia921
Can you run this and let me know if you're able to receive a message?

>>> messenger.send_template("hello_world", "255757xxxxxx", components={})

this way works for me, any other method doesn't give any error but doesn't send anything either.

Did you add your number as one of the test numbers to the Facebook developer portal?

You could also try replying first to the number before sending any other message other than the template message

Replying first to the number solve the problem. Thanks.

@RadiBytes
Copy link

Is anyone still having this issue?
Here are the common causes:

  • You're sending a media that includes a broken link.
  • Your message content has broken a Whatsapp messaging rule. For example:
    • Having a button with text that is more than 20 characters will result in a success response, but the message will not be sent to the user.
    • Having interactive message that includes more than the specified 3 buttons or more than the specified 10 list items will result in the same thing.
    • Having a footer with text that is more than 20 characters will result in same.
  • You are trying to send a non-template message to a user who hasn't messaged your bot within the last 24 hours.(This should actually throw an error)

@filipporomani
Copy link
Contributor

I had this problem the very first time I set up the Facebook Dev Portal, fixed it by sending an SMS to the test number.

@filipporomani
Copy link
Contributor

image

Okkk so I got this issue again, this was the fix

@filipporomani
Copy link
Contributor

Just send a template message and you are done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants