curl --request POST \
--url https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}/test \
--header 'Authorization: Bearer <token>'const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}/test"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text){
"object": "webhook_delivery",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"webhook_endpoint_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"event": "call.started",
"status": "pending",
"attempts": 1,
"response_status": 123,
"failure_reason": "http_error",
"created_at": "2023-11-07T05:31:56Z",
"delivered_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}Send a test delivery
An event with fictional data, signed and sent like a real one: call.ended for a voice agent or, on a text agent, the first event the endpoint listens for in the order of WebhookEvent, with a test lead whose number is 555. It does not count towards automatic pausing, and it is sent once: a failed test delivery is not retried. A paused endpoint returns 409 webhook_endpoint_disabled: reactivate it first.
curl --request POST \
--url https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}/test \
--header 'Authorization: Bearer <token>'const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://rest.newlead.ai/v1/webhook_endpoints/{webhook_endpoint_id}/test"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text){
"object": "webhook_delivery",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"webhook_endpoint_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"event": "call.started",
"status": "pending",
"attempts": 1,
"response_status": 123,
"failure_reason": "http_error",
"created_at": "2023-11-07T05:31:56Z",
"delivered_at": "2023-11-07T05:31:56Z"
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}{
"error": {
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "phone must match pattern \"^\\+[1-9]\\d{6,14}$\".",
"param": "phone",
"request_id": "req_m3k2a9_4f1c2b7e",
"doc_url": "https://docs.newlead.ai/errors#parameter_invalid"
}
}Authorizations
Response
The delivery, queued. Track its status in the endpoint's deliveries list.
call.* events belong to voice agents; the others belong to text agents. What each event carries and how to verify the signature are at https://docs.newlead.ai/webhook-events.
call.started, call.rejected, call.ended, call.analyzed, lead.created, lead.qualified, lead.appointment_booked, lead.handoff, follow_up.sent, message.received, message.failed Why the last attempt failed, or null if it has not failed. http_error: your server responded outside 2xx (see response_status). redirect_not_followed: it responded with a redirect, which is not followed. timeout: no response within 10 seconds. connection_failed: could not connect (DNS, TLS or a private address). not_attempted: the endpoint was paused or deleted before the delivery was sent or retried.
http_error, redirect_not_followed, timeout, connection_failed, not_attempted, null