REST ClientPhone Numbers

set_swml_webhook

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.

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

Parameters

resource_id
strRequired

ID of the phone number to bind.

url
strRequired

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

**extra
Any

Additional fields forwarded to update (e.g. name, call_fallback_url).

Returns

dict — The updated phone number resource.

Example

from signalwire.rest import RestClient
client = RestClient(
project="your-project-id",
token="your-api-token",
host="your-space.signalwire.com",
)
client.phone_numbers.set_swml_webhook(
"phone-number-id",
"https://example.com/swml",
)