import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const webhookDelivery = await client.webhookDeliveries.retrieve('C9C0797E-901D-4349-A33C-C2C8F31A92C2');
console.log(webhookDelivery.data);{
"data": {
"id": "f5586561-8ff0-4291-a0ac-84fe544797bd",
"user_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
"record_type": "webhook_delivery",
"status": "delivered",
"webhook": {
"record_type": "event",
"id": "C9C0797E-901D-4349-A33C-C2C8F31A92C2",
"event_type": "call_initiated",
"occurred_at": "2020-08-10T13:02:01.000Z",
"payload": {
"useful": "information"
}
},
"started_at": "2020-08-10T14:00:00.000Z",
"finished_at": "2020-08-10T14:00:05.595Z",
"attempts": [
{
"status": "delivered",
"started_at": "2020-08-10T14:00:05.364Z",
"finished_at": "2020-08-10T14:00:05.595Z",
"http": {
"request": {
"url": "https://fallback.example.com/webhooks",
"headers": [
[
"Accept",
"*/*"
]
]
},
"response": {
"status": 200,
"headers": [
[
"Content-Type",
"text/html"
]
],
"body": "All good."
}
}
},
{
"status": "failed",
"started_at": "2020-08-10T14:00:05.004Z",
"finished_at": "2020-08-10T14:00:05.360Z",
"http": {
"request": {
"url": "https://typo.example.com/webhooks",
"headers": [
[
"Accept",
"*/*"
]
]
},
"response": {
"status": 404,
"headers": [
[
"Content-Type",
"text/html"
],
[
"Pragma",
"no-cache"
]
],
"body": "Oops. Not found."
}
},
"errors": [
75499
]
}
]
}
}Provides webhook_delivery debug data, such as timestamps, delivery status and attempts.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const webhookDelivery = await client.webhookDeliveries.retrieve('C9C0797E-901D-4349-A33C-C2C8F31A92C2');
console.log(webhookDelivery.data);{
"data": {
"id": "f5586561-8ff0-4291-a0ac-84fe544797bd",
"user_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
"record_type": "webhook_delivery",
"status": "delivered",
"webhook": {
"record_type": "event",
"id": "C9C0797E-901D-4349-A33C-C2C8F31A92C2",
"event_type": "call_initiated",
"occurred_at": "2020-08-10T13:02:01.000Z",
"payload": {
"useful": "information"
}
},
"started_at": "2020-08-10T14:00:00.000Z",
"finished_at": "2020-08-10T14:00:05.595Z",
"attempts": [
{
"status": "delivered",
"started_at": "2020-08-10T14:00:05.364Z",
"finished_at": "2020-08-10T14:00:05.595Z",
"http": {
"request": {
"url": "https://fallback.example.com/webhooks",
"headers": [
[
"Accept",
"*/*"
]
]
},
"response": {
"status": 200,
"headers": [
[
"Content-Type",
"text/html"
]
],
"body": "All good."
}
}
},
{
"status": "failed",
"started_at": "2020-08-10T14:00:05.004Z",
"finished_at": "2020-08-10T14:00:05.360Z",
"http": {
"request": {
"url": "https://typo.example.com/webhooks",
"headers": [
[
"Accept",
"*/*"
]
]
},
"response": {
"status": 404,
"headers": [
[
"Content-Type",
"text/html"
],
[
"Pragma",
"no-cache"
]
],
"body": "Oops. Not found."
}
},
"errors": [
75499
]
}
]
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Uniquely identifies the webhook_delivery.
"C9C0797E-901D-4349-A33C-C2C8F31A92C2"
Webhook delivery record.
Record of all attempts to deliver a webhook.
Show child attributes
Uniquely identifies the webhook_delivery record.
"f5586561-8ff0-4291-a0ac-84fe544797bd"
Uniquely identifies the user that owns the webhook_delivery record.
"0ccc7b54-4df3-4bca-a65a-3da1ecc777f0"
Identifies the type of the resource.
"webhook_delivery"
Delivery status: 'delivered' when successfuly delivered or 'failed' if all attempts have failed.
delivered, failed Original webhook JSON data. Payload fields vary according to event type.
Show child attributes
Identifies the type of the resource.
event "event"
The type of event being delivered.
"webhook.command"
Identifies the type of resource.
"0ccc7b54-4df3-4bca-a65a-3da1ecc777f0"
ISO 8601 datetime of when the event occurred.
"2018-02-02T22:25:27.521992Z"
{
"record_type": "event",
"id": "C9C0797E-901D-4349-A33C-C2C8F31A92C2",
"event_type": "call_initiated",
"occurred_at": "2020-08-10T13:02:01.000Z",
"payload": { "useful": "information" }
}ISO 8601 timestamp indicating when the first request attempt was initiated.
"2020-08-10T14:00:00.000Z"
ISO 8601 timestamp indicating when the last webhook response has been received.
"2020-08-10T14:00:05.595Z"
Detailed delivery attempts, ordered by most recent.
Show child attributes
delivered, failed ISO 8601 timestamp indicating when the attempt was initiated.
ISO 8601 timestamp indicating when the attempt has finished.
HTTP request and response information.
Show child attributes
Webhook delivery error codes.
[
{
"status": "delivered",
"started_at": "2020-08-10T14:00:05.364Z",
"finished_at": "2020-08-10T14:00:05.595Z",
"http": {
"request": {
"url": "https://fallback.example.com/webhooks",
"headers": [["Accept", "*/*"]]
},
"response": {
"status": 200,
"headers": [["Content-Type", "text/html"]],
"body": "All good."
}
}
},
{
"status": "failed",
"started_at": "2020-08-10T14:00:05.004Z",
"finished_at": "2020-08-10T14:00:05.360Z",
"http": {
"request": {
"url": "https://typo.example.com/webhooks",
"headers": [["Accept", "*/*"]]
},
"response": {
"status": 404,
"headers": [
["Content-Type", "text/html"],
["Pragma", "no-cache"]
],
"body": "Oops. Not found."
}
},
"errors": [75499]
}
]Was this page helpful?