Skip to navigation

Create a new cXML webhook resource.

Request

primary_request_urlstringRequiredformat: "uri"
Primary request url of the CXML Webhook.
namestringOptional
Name of the CXML Webhook.
script_typeenumOptionalDefaults to calling
Whether this CXML Webhook handles calls, messages, or faxes.
Allowed values:
primary_request_methodenumOptionalDefaults to POST
Primary request method of the CXML Webhook.
Allowed values:
fallback_request_urlstringOptionalformat: "uri"
Fallback request url of the CXML Webhook.
fallback_request_methodenumOptionalDefaults to POST
Fallback request method of the CXML Webhook.
Allowed values:
status_callback_urlstringOptionalformat: "uri"
Status callback url of the CXML Webhook.
status_callback_methodenumOptionalDefaults to POST
Status callback method of the CXML Webhook.
Allowed values:
used_forenumOptionalDeprecated
Deprecated. Use `script_type`. Read only when `script_type` is not sent.
Allowed values:

Response

idstringRequiredformat: "uuid"
Unique ID of the CXMLWebhook.
project_idstringRequiredformat: "uuid"
Unique ID of the Project.
display_namestringRequired
Display name of the CXMLWebhook Fabric Resource
typeenumRequired
Type of the Fabric Resource
Allowed values:
created_atdatetimeRequired
Date and time when the resource was created.
updated_atdatetimeRequired
Date and time when the resource was updated.
cxml_webhookobjectRequired
CXMLWebhook data.

Response Example

Response
{
"id": "a87db7ed-8ebe-42e4-829f-8ba5a4152f54",
"project_id": "99151cf8-9548-4860-ba70-a8de824f3312",
"display_name": "Booking Assistant",
"type": "cxml_webhook",
"created_at": "2024-05-06T12:20:00Z",
"updated_at": "2024-05-06T12:20:00Z",
"cxml_webhook": {
"id": "a87db7ed-8ebe-42e4-829f-8ba5a4152f54",
"name": "My CXML Webhook",
"script_type": "calling",
"primary_request_url": "https://primary.com",
"primary_request_method": "GET",
"fallback_request_url": "https://fallback.com",
"fallback_request_method": "GET",
"status_callback_url": "https://callback.com",
"status_callback_method": "POST",
"used_for": "calling"
}
}

Example

import { RestClient } from "@signalwire/sdk";
const client = new RestClient({
project: "your-project-id",
token: "your-api-token",
host: "your-space.signalwire.com",
});
const result = await client.fabric.cxmlWebhooks.create({
name: "my-webhook",
primary_request_url: "https://example.com/cxml",
});
console.log("Created:", result.id);