WhatsApp Business API not sending /message endpoint or test messages to phone
I've setup a WhatsApp Business to test their new WhatsApp API for sending messages. I've followed the getting started guide, but I'm running into an issue when trying to send a test message to my phone.
I tested sending messages using the test message call in the business settings as shown in the guide and I've created my own /messages
call in Postman using a permanent token. Both calls return a 200 status, but neither of them actually sends a message to my phone.
To double check my setup, I added a colleagues phone to the setup and he receives the messages and can interact with my webhook via WhatsApp just fine.
Some posts on Stackoverflow mention having to send a message to the test number first, but I was unable to get this to work and my colleague didn't have to do this.
Is there some kind of setting or issue that could explain why I'm not receiving the messages? I've even tried re-installing WhatsApp and setting up my phonenumber again, but that didn't change anything either.
Updates:
I tried validating my phonenumber via the /contacts
endpoint, but it keeps returning an auth error. Updating my token to include all Whatsapp permissions did not change this, whatsapp_business_api_data
isn't an option to include.
{ "error": { "message": "(#100) The parameter whatsapp_business_api_data is required.", "type": "OAuthException", "code": 100, "fbtrace_id": "" } }
I noticed that my webhook included a status object in change.value.statuses.[0]
this mentioned the following:
{ status: 'failed', errors: [{ code: 131000, title: 'Failure due to an internal error. Please retry.' }]}
Next I created a new app and added the Whatsapp integration, I added and validated my phonenumber via a text and tried to send a test messsage. This also doesn't start a conversation nor does it give me any feedback. If I try to add my phonenumber again, by adding it as another number, I cant and get the error Reason: VERIFIED
You can only send a template type message as your first message to a user. From the error message, it looks like you're hitting the Graph API version lower than v12.0. Try with V12.0 and higher. Also, it will be helpful if you can paste the response you get from your API request and in your Webhook.
I'm sending the test message made by Facebook. So I don't think this is the issue. I tried a new phonenumber and the message got through just fine.
I solved it in v14.0 answering the first template message
Why do we have to wait for the user to respond, before sending custom messages?
I tried many template type messages but all of them got rejected. Meta is treating us like we were their slaves feeding their databases with our data to make them bigger
For me this was a different case. I found out that receiving phone number must send a message. Eg: "hi" to sending number. And after that only messaging works
{ "messaging_product":"whatsapp", "preview_url": true, "recipient_type": "individual", "to": "<receiving phone no>", "type": "text", "text": { "body": "Tudo bem?" } }Here send a test message from to sending number. Eg: "Hi"
I logged in just to upvote this message. THIS IS THE SOLUTION.
In order for your example to work, please add the 'messaging_product' property.
In the case of using a template:
{ "messaging_product":"whatsapp", "to":"55619917206XX", "type":"template", "template":{ "name":"bem_vindo", "language":{ "code":"pt_BR" } } }In the case of a template with parameters:
{ "messaging_product":"whatsapp", "to":"55619917206XX", "type":"template", "template":{ "name":"test_message", "language":{ "code":"pt_BR" }, "components": [ { "type": "body", "parameters": [ {"type": "text", "text": "oi"} ] } ] } }In the case of text:
{ "messaging_product":"whatsapp", "preview_url": true, "recipient_type": "individual", "to": "55619917206XX", "type": "text", "text": { "body": "Tudo bem?" } }In this case, if the message does not arrive, send a "Hi" in the WhatsApp conversation and try again.
On my test number I send Hi but it is not delivered at all
So it's not the best answer to the issue, but I got a new phonenumber to test this out on. I added it to my test numbers, validated the number, sent a test message to the new number and received it just fine.
I'm not sure if the issue was caused by a privacy setting or an issue on Facebook side, but the old number still doesn't receive the messages.
I had a similar problem here while trying to test sending messages using a template with Marketing format.
Messages using templates with Utility format were being delivered while messages using templates using Marketing format were not.
Turns out WhatsApp limits the number of Marketing messages a number can receive. You can only send more marketing messages if the user replies to the first or second message.
After I replied to the last message, the new messages started to be delivered again.
For more info: https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates#per-user-marketing-template-message-limits
To ensure successful transmission of WhatsApp messages via API using Postman, please follow these steps:
Navigate to the Authorization tab within Postman. Select "Bearer token" as the type of authorization. Paste your token in the designated field. Proceed to the Body tab and select the raw option. Insert your data accordingly, adhering to the provided JSON format example:
{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": "Number_with_country_code", "type": "template", "template": { "name": "your_template_name", "language": { "code": "en" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "5888" } ] } ] } }Kindly execute the request now and verify if the issue persists.
Thank you.
I had the same error code but with a different message:
I fixed it by deleting the whatsapp number here and adding it again.
Check the company code. It should be prefixed.
{ "messaging_product": "whatsapp", "to": "91xxxxxxxx", "type": "template", "template": { "name": "hello_world", "language": { "code": "en_US" } } }Some colleagues weren't receiving any messages. In my case, the problem was that they haven't accepted the WhatsApp's Terms and Condition.
To accept the terms, they had to start a new conversation with the business. A popup appears to review and accept the terms.
Once accepted, they received the messages without problem.
PS: I'm in Spain, maybe it's a European Union thing...
I got the same issue, resolved it by sending the message multiple times through the api in watsapp setup, getting started page. Also accepted the number in personal watsapp by allowing it to continue.
2024
I got the same error, after reading here. I found the easiest solution to be this:
1- If you chose the default language recommendation, check whether:
"language": { "code": "en" } } }is correct for your chosen language.
Example the hello_world language is en_US. While I decided to use the en option which was recommended while saving the template.
Messages are now going through without an issue.
I changed en_US to en and it gave the following error: {"error":{"message":"(#132001) Template name does not exist in the translation","type":"OAuthException","code":132001,"error_data":{"messaging_product":"whatsapp","details":"template name (hello_world) does not exist in en"},"fbtrace_id":"AY8GOOBoBZlNd-KK4az9_9S"}}% ➜ T4PSeries git:(main) ✗