API Error Handling
Basic Error Handling
Every error response from the Chirp API has the same structure. Start by checking theerror.type field to determine the category of the problem.
Handling Specific Error Codes
When an error includes acode field, you can use it to branch your logic and take specific actions.
Handling specific error codes
Handling Provider Errors
When an error has aprovider object, you can access the raw error from Meta or Telnyx for additional debugging context.
Handling provider errors
Handling Validation Errors
When theparam field is present, it tells you which request parameter caused the error. Use this to provide targeted feedback in your UI.
Handling validation errors
Webhook Error Handling
When a message fails to deliver, Chirp sends a webhook event with the error details in the same format as API errors.Receiving Failed Events
Failed delivery events include anerror object in the data payload.
Webhook error handling
Webhook Failure Payload
Here is an example of a failed WhatsApp message webhook:WhatsApp failure webhook
Retry Strategies
Not all errors should be retried. Use the following table to determine whether an error is retryable.When to Retry
Exponential Backoff
For retryable errors, use exponential backoff to avoid overwhelming the API.Exponential backoff
Logging Best Practices
Log error details to help your team debug issues in production.Error logging
When contacting Meta support about a WhatsApp issue, always include the
fbtrace_id from the error response. This allows Meta to look up the exact request in their systems.