setSwmlWebhook

View as MarkdownOpen in Claude

Route inbound calls on this phone number to an SWML webhook URL. Your backend returns an SWML document per call. The server auto-creates a swml_webhook Fabric resource keyed off this URL — you do not need to call fabric.swmlWebhooks.create or fabric.resources.assignPhoneRoute.

This is a typed wrapper over update that sets call_handler to relay_script and populates call_relay_script_url for you.

Parameters

resourceId
stringRequired

ID of the phone number to bind.

url
stringRequired

Webhook URL that returns SWML. The server keys the auto-created Fabric resource off this value.

extra
SetSwmlWebhookExtraDefaults to {}

Additional wire-level fields merged into the PUT body (e.g. name, call_fallback_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.setSwmlWebhook("phone-number-id", "https://example.com/swml");