YCloud failed to send messages
whatsappApiError
in response body
whatsappApiError
in response bodyYou may get an error response body including the field error.whatsappApiError
when you send WhatsApp messages by the YCloud API, typically the Send a WhatsApp message directly API.
Here is a sample error response with HTTP status 429
when you send too many messages to the same phone number:
{
"error": {
"status": 429,
"code": "TOO_MANY_REQUESTS",
"message": "(#131056) (Business Account, Consumer Account) pair rate limit hit",
"target": "whatsappApiError",
"docUrl": "https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes",
"requestId": "req_1KjtKI80IKoaJNa6n6p",
"whatsappApiError": {
"message": "(#131056) (Business Account, Consumer Account) pair rate limit hit",
"type": "OAuthException",
"code": "131056",
"fbtrace_id": "A4O5a8RAgePwbcGSu",
"error_data": {
"messaging_product": "whatsapp",
"details": "Message failed to send because there were too many messages sent from this phone number to the same phone number in a short period of time."
}
}
}
}
In this case, we tried to request the WhatsApp Business API and got an error response. error.whatsappApiError
is included to help you identify the error reason.
whatsappApiError
in webhook payload
whatsappApiError
in webhook payloadIf you are using the Enqueue a WhatsApp message API, you will never get an error response having error.whatsappApiError
since we submit your messages to the WhatsApp Business API asynchronously. You can get it by configuring a webhook listening for whatsapp.message.updated
events. Here is an example of the webhook payload:
{
"id": "evt_eEVCy8eNqD9EvcFI",
"type": "whatsapp.message.updated",
"apiVersion": "v2",
"createTime": "2023-02-22T12:00:00.000Z",
"whatsappMessage": {
"id": "63f5d602367ea403f8175a6c",
"wamid": "wamid.BgNODYxN...",
"status": "failed",
"errorCode": "131056",
"errorMessage": "(#131056) (Business Account, Consumer Account) pair rate limit hit",
"whatsappApiError": {
"message": "(#131056) (Business Account, Consumer Account) pair rate limit hit",
"type": "OAuthException",
"code": "131056",
"fbtrace_id": "A4O5a8RAgePwbcGSu",
"error_data": {
"messaging_product": "whatsapp",
"details": "Message failed to send because there were too many messages sent from this phone number to the same phone number in a short period of time."
}
},
"totalPrice": 0.0,
"currency": "USD",
"bizType": "whatsapp"
}
Error Codes returned by the WhatsApp Business API
The whatsappApiError
is exactly the WhatsApp Business Cloud API Error. Listed below are some possible error codes that may be returned through the YCloud API.
Code | Description | Possible Solutions | HTTP Status |
---|---|---|---|
| Temporary due to downtime or due to being overloaded. | Check the WhatsApp Business Platform Status page to see API status information before trying again. |
|
| The request included one or more unsupported or misspelled parameters. Or the recipient phone number is not a WhatsApp phone number. |
| |
| Cloud API message throughput has been reached. | The app has reached the API's throughput limit. See Throughput. Try again later or reduce the frequency with which the app sends messages. |
|
| Message failed to send due to an unknown error. | Try again. If the error persists, contact us to open a Direct Support ticket. |
|
| The request is missing a required parameter. |
| |
| Unable to deliver message. Reasons can include: | Using a non-WhatsApp communication method, ask the WhatsApp user to: |
|
| The WhatsApp Business Account associated with the app has been restricted or disabled for violating a platform policy, or we were unable to verify data included in the request against data set on the WhatsApp Business Account (e.g, the two-step pin included in the request is incorrect). | See the Policy Enforcement document to learn about policy violations and how to resolve them. |
|
| Too many messages sent from the sender phone number to the same recipient phone number in a short period of time. | Wait and retry the operation, if you intend to send messages to the same phone number. You can still send messages to a different phone number without waiting. |
|
| The number of variable parameter values included in the request did not match the number of variable parameters defined in the template. | Make sure the request includes all of the variable parameter values that have been defined in the template. |
|
| The template does not exist in the specified language or the template has not been approved. | Make sure your template has been approved and the template name and language locale are correct. |
|
| Template content violates a WhatsApp policy. | See Rejection Reasons to determine possible reasons for violation. |
|
| Variable parameter values formatted incorrectly. | The variable parameter values included in the request are not using the format specified in the template. |
|
| Template is paused due to low quality so it cannot be sent in a template message. | Edit the template to improve its quality and try again once it is approved. |
|
| Template has been paused too many times due to low quality and is now permanently disabled. | Create a new template with different content. |
|
| Business Phone number not registered on the WhatsApp Business Platform. | Register the phone number before trying again. |
|
| Message was not sent as part of an experiment. |
|
Error Codes returned by the YCloud API
Be aware that error.whatsappApiError
is not included when errors were detected by YCloud and we didn't request the WhatsApp Business API. For example, you provide an invalid phone number and then get the error response:
{
"error": {
"status": 400,
"code": "PARAM_INVALID",
"message": "Invalid E.146 phone number: +001",
"target": "to",
"docUrl": "https://docs.ycloud.com/v2/reference/errors#param_invalid",
"requestId": "req_69UpMOaMHFrBMGZexYvUDw"
}
}
The error.code
is one of the YCloud server-defined error codes.
Listed below are some possible error codes returned by the YCloud API:
Code | Description | HTTP Status |
---|---|---|
PARAM_INVALID | One or more of the parameters is invalid. | 400 Bad Request |
PARAM_MISSING | One or more of the parameters is missing. | 400 Bad Request |
BALANCE_INSUFFICIENT | The account balance is insufficient. | 403 Forbidden |
WHATSAPP_BUSINESS_ACCOUNT_UNAVAILABLE | The WhatsApp business account is unavailable. | 403 Forbidden |
WHATSAPP_PHONE_NUMBER_UNAVAILABLE | The WhatsApp business phone number is unavailable. | 403 Forbidden |
WHATSAPP_TEMPLATE_UNAVAILABLE | The WhatsApp template is unavailable. | 403 Forbidden |
UNAUTHORIZED | Unauthorized. Make sure you are using the correct API Key in the 'X-API-Key' header. | 403 Forbidden |
YCloud Error Codes conveyed by webhooks
If you are using the Enqueue a WhatsApp message endpoint, the message may fail due to a YCloud error. That is, the whatsappMessage.errorCode
in webhook payload can also convey one of the YCloud Error Codes, such as BALANCE_INSUFFICIENT
.
Here are some possible errors:
Error Code | Description | Possible Solutions |
---|---|---|
INTERNAL_SERVER_ERROR | Temporary due to downtime or due to being overloaded. | Wait and retry the operation. This error may be caused by a timeout in our call to the WhatsApp Business API. |
BALANCE_INSUFFICIENT | Your account balance is insufficient. | Top-up. |
RECIPIENT_UNSUBSCRIBED | The recipient has unsubscribed. | If you must deliver the message to the recipient, set the request parameter filterUnsubscribed to false , or go to Dashboard → Contact → Unsubscribe and remove them from the unsubscribe list. |
Meta failed to send messages
Not all of the error codes listed in the WhatsApp Business Cloud API Error page are returned through the YCloud API. Even if a message is successfully submitted to the WhatsApp Business API, it may also fail to send. Meta notifies YCloud about these errors via webhooks. You should Configure Webhooks listening for whatsapp.message.updated
events to receive these notifications from YCloud. Here is an example of the webhook payload for submitted but finally failed messages:
{
"id": "evt_eEVCy8eNqD9EvcFI",
"type": "whatsapp.message.updated",
"apiVersion": "v2",
"createTime": "2023-02-22T12:00:00.000Z",
"whatsappMessage": {
"id": "63f5d602367ea403f8175a6c",
"wamid": "wamid.BgNODYxN...",
"status": "failed",
"errorCode": "131048",
"errorMessage": "Message failed to send because there are restrictions on how many messages can be sent from this phone number.This may be because too many previous messages were blocked or flagged as spam.",
"totalPrice": 0.0,
"currency": "USD",
"bizType": "whatsapp"
}
}
The whatsappMessage.errorCode
conveys the WhatsApp Business API Error code.
Meta Error Codes conveyed by webhooks
Listed below are some possible error codes conveyed by YCloud webhooks, that originated from Meta webhooks:
Code | Description | Possible Solutions |
---|---|---|
| Message failed to send due to an unknown error. | Try again. If the error persists, contact us to open a Direct Support ticket. |
| Unable to deliver message. Reasons can include: | Using a non-WhatsApp communication method, ask the WhatsApp user to: |
| The WhatsApp Business Account associated with the app has been restricted or disabled for violating a platform policy, or we were unable to verify data included in the request against data set on the WhatsApp Business Account (e.g, the two-step pin included in the request is incorrect). | See the Policy Enforcement document to learn about policy violations and how to resolve them. |
| More than 24 hours have passed since the recipient last replied to the sender number. | Send the recipient a business-initiated message using a message template instead. |
| Message failed to send because there are restrictions on how many messages can be sent from this phone number. This may be because too many previous messages were blocked or flagged as spam. | Check your quality status in the WhatsApp Manager and see the Quality-Based Rate Limits documentation for more information. |
| This message was not delivered to maintain healthy ecosystem engagement. | Do not retry immediately if you do receive this error code and suspect it is due to the limit. Instead, retry in increasing larger time increments until the message is delivered, since the limit may be in effect for differing periods of time. |
| Unable to upload the media used in the message. | We were unable to upload the media for one or more reasons, such as an unsupported media type. |
| Unable to deliver the message. This recipient has chosen to stop receiving marketing messages on WhatsApp from your business |