setCxmlWebhook

View as MarkdownOpen in Claude

Route inbound calls on this phone number to a cXML (Twilio-compat / LAML) webhook. Despite the wire value laml_webhooks being plural, this creates a single cxml_webhook Fabric resource on the server.

This is a typed wrapper over update that sets call_handler to laml_webhooks and populates the URL fields for you.

For SWML webhooks, use setSwmlWebhook instead.

Parameters

resourceId
stringRequired

ID of the phone number to bind.

params
SetCxmlWebhookParamsRequired

Webhook URL and options.

params.url
stringRequired

Primary cXML document URL. Serialized as call_request_url.

params.fallbackUrl
string

Fallback URL invoked when the primary URL fails. Serialized as call_fallback_url.

params.statusCallbackUrl
string

URL that receives call-status updates. Serialized as call_status_callback_url.

Returns

Promise<any> — The updated phone-number resource.

Example

1import { RestClient } from "@signalwire/sdk";
2
3const client = new RestClient({
4 project: "your-project-id",
5 token: "your-api-token",
6 host: "your-space.signalwire.com"
7});
8
9await client.phoneNumbers.setCxmlWebhook("phone-number-id", {
10 url: "https://example.com/voice.xml",
11 fallbackUrl: "https://example.com/fallback.xml",
12 statusCallbackUrl: "https://example.com/status",
13});