Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my whatsapp message not being sent?

Tags:

whatsapp

Testing with Postman, I'm trying to send a message per the glitch example project from docs

I'm trying to write an API endpoint I can hit with a webhook when people send a message to my Org's whatsapp number. The API would send an automated response.

When I send the POST, with the following body to https://graph.facebook.com/v14.0/redacted/messages it comes back with the following response:

{
  "error": {
    "message": "(#131030) Recipient phone number not in allowed list",
    "type": "OAuthException",
    "code": 131030,
    "error_data": {
      "messaging_product": "whatsapp",
      "details": "Recipient phone number not in allowed list: Add recipient phone number to recipient list and try again."
    },
    "error_subcode": 2655007,
    "fbtrace_id": "A5YKQbpB0PEaaA-gIROEv-n"
  }
}

The error code isn't list one the error codes page, nor can I find anything about adding a recipient phone number anyway (it doesn't make sense to require a pre-defined list of recipient phone numbers to which I can send messages).

Here's the message body:

{
  "messaging_product": "whatsapp",
  "to": "redacted",
  "text": {
    "body": "Ack: Hello world"
  }
}

How do I get the message sent? I'm not able to proceed with development of my app until I can send a message.

like image 658
Logany-hi Avatar asked Oct 22 '25 11:10

Logany-hi


2 Answers

Just Remove + from your mobile number and add you country code before your number.

Then its working fine.

Request Body:

{
    "messaging_product": "whatsapp",
    "to": "91xxxxxxxxxx",
    "type": "template",
    "template": {
        "name": "hello_world",
        "language": {
            "code": "en_US"
        }
    }
}

Response Body:

{
    "messaging_product": "whatsapp",
    "contacts": [
        {
            "input": "91xxxxxxxxxx",
            "wa_id": "91xxxxxxxxxx"
        }
    ],
    "messages": [
        {
            "id": "wamid.HBgMOTE3NTM4OTE4MzIyFQIAERgSOERCM0ZDOTJFMDk1RjBFNURBAA=="
        }
    ]
}

for Your Reference

like image 197
Prakash Sahoo Avatar answered Oct 27 '25 04:10

Prakash Sahoo


The error for Postman comes from a mislabelling in the template file for the variable {{Recipient-WA-ID}}. The environment variable should be renamed to this from {{Recipient-Phone-Number}} (or vice-versa)

like image 23
Max Avatar answered Oct 27 '25 02:10

Max