Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Debugging Events Webhook


When an error or warning takes place on your Twilio account, this event is published into Twilio's Debugging System. This is the system that powers the Monitor Alerts API, Alert Triggers and the Console Debugger.

The Console Debugger(link takes you to an external page) allows developers to configure an optional webhook to receive data about errors and warnings as they happen. This makes it easy for developers to react to problems with their applications promptly.

If the Console Debugger webhook is configured, Twilio will make an HTTP POST request for debugging events as they occur. Below is an overview of the parameters passed.

(information)

Info

Twilio can send your web application an HTTP request when certain events happen, such as an incoming text message to one of your Twilio phone numbers. These requests are called webhooks, or status callbacks. For more, check out our guide to Getting Started with Twilio Webhooks. Find other webhook pages, such as a security guide and an FAQ in the Webhooks section of the docs.


Debugging Event Callback Parameters

debugging-event-callback-parameters page anchor
PropertyDescription
SidUnique identifier of this Debugger event.
AccountSidUnique identifier of the account that generated the Debugger event.
ParentAccountSidUnique identifier of the Parent Account. This parameter only exists if the above account is a subaccount.
TimestampTime of occurrence of the Debugger event.
LevelSeverity of the Debugger event. Possible values are Error and Warning.
PayloadTypeapplication/json
PayloadJSON data specific to the Debugging Event.

Payload

payload page anchor

The payload is a JSON object that provides more information about the Debugging Event in question.

PropertyDescription
resource_sidThe ID of this Twilio Platform Resource that this error is associated with
service_sidThe ID of the Twilio Platform Service that this error is associated with
error_codeThe unique error code for this debugging event
more_infoA subdocument containing more information about this debugging event
webhookA subdocument containing Information about the request and response of the webhook associated with this debugging event.

more_info

more_info page anchor

The more_info property of the payload is optional and contains additional information specific to the Twilio product/feature that published this debugging event.

The webhook property of the payload is optional. It is only present if a webhook request is associated with the debugging event.


_19
{
_19
'request': {
_19
'method': 'POST',
_19
'url': 'http://twimlets.com/forward?PhoneNumber=800-421-9004',
_19
'headers': {
_19
'key': 'value'
_19
},
_19
'parameters': {
_19
'key': 'value'
_19
}
_19
},
_19
'response': {
_19
'status_code': 200,
_19
'headers': {
_19
'key': 'value'
_19
},
_19
'body': '<Response><Dial>800-421-9004</Dial></Response>'
_19
}
_19
}


Representative Example of a Debugging Event Webhook

representative-example-of-a-debugging-event-webhook page anchor

This is an example of a debugging event webhook. The details of what will be in this webhook request depend on what type of error the Twilio Debugger handles. For this example, the webhook event was omitted for brevity, but an example of what it might look like is in the previous section.

This HTTP Body is sent as an HTTP POST to your webhook, and encoded as application/x-www-form-urlencoded. Within that request body, the Payload property is a JSON object that you would need to decode.

The X-Twilio-Signature HTTP header will be sent with this HTTP POST, and you should use it to validate that the request is indeed from Twilio. Learn more about Validating Signatures from Twilio


_24
AccountSid ACxxxxxxxxxxxxxxxxxxxxxxxx
_24
Level ERROR
_24
ParentAccountSid
_24
Payload {
_24
"resource_sid":"CAxxxxxxxx",
_24
"service_sid":null,
_24
"error_code":"11200",
_24
"more_info":{
_24
"msg":"An attempt to retrieve content from https://yyy.zzz returned the HTTP status code 404",
_24
"Msg":"An attempt to retrieve content from https://yyy.zzz returned the HTTP status code 404",
_24
"sourceComponent":"12000",
_24
"ErrorCode":"11200",
_24
"httpResponse":"404",
_24
"url":"https://yyy.zzz",
_24
"LogLevel":"ERROR"
_24
},
_24
"webhook":{
_24
"type":"application/json",
_24
"request": <Specific Twilio Request Details to your Webhook here as a JSON Object>
_24
}
_24
}
_24
PayloadType application/json
_24
Sid NOxxxxx
_24
Timestamp 2020-01-01T23:28:54Z

Below is a cURL snippet based on the above example that you can customize to simulate a debugging event webhook.


_27
curl -X "POST" "https://your-server.example.com/webhook" \
_27
-H 'I-Twilio-Idempotency-Token: idempotency-token-goes-here' \
_27
-H 'X-Twilio-Signature: correct-signature-goes-here' \
_27
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
_27
--data-urlencode "AccountSid=ACxxxxxxxxxxxxxxxxxxxxxxxx" \
_27
--data-urlencode "Level=ERROR" \
_27
--data-urlencode "ParentAccountSid=" \
_27
--data-urlencode "Payload={
_27
\"resource_sid\":\"CAxxxxxxxx\",
_27
\"service_sid\":null,
_27
\"error_code\":\"11200\",
_27
\"more_info\":{
_27
\"msg\":\"An attempt to retrieve content from https://yyy.zzz returned the HTTP status code 404\",
_27
\"Msg\":\"An attempt to retrieve content from https://yyy.zzz returned the HTTP status code 404\",
_27
\"sourceComponent\":\"12000\",
_27
\"ErrorCode\":\"11200\",
_27
\"httpResponse\":\"404\",
_27
\"url\":\"https://yyy.zzz\",
_27
\"LogLevel\":\"ERROR\"
_27
},
_27
\"webhook\":{
_27
\"type\":\"application/json\",
_27
\"request\": {} }
_27
}" \
_27
--data-urlencode "PayloadType=application/json" \
_27
--data-urlencode "Sid=NOxxxxx" \
_27
--data-urlencode "Timestamp=2020-01-01T23:28:54Z"


Rate this page: