> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# setSwmlWebhook

> Route inbound calls to an SWML webhook URL.

[update]: /docs/server-sdks/reference/typescript/rest/phone-numbers/update

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`][update] that sets `call_handler` to
`relay_script` and populates `call_relay_script_url` for you.

## **Parameters**

<ParamField path="resourceId" type="string" required={true} toc={true}>
  ID of the phone number to bind.
</ParamField>

<ParamField path="url" type="string" required={true} toc={true}>
  Webhook URL that returns SWML. The server keys the auto-created Fabric
  resource off this value.
</ParamField>

<ParamField path="extra" type="SetSwmlWebhookExtra" default="{}" toc={true}>
  Additional wire-level fields merged into the PUT body (e.g. `name`,
  `call_fallback_url`).
</ParamField>

## **Returns**

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

## **Example**

```typescript {9}
import { RestClient } from "@signalwire/sdk";

const client = new RestClient({
  project: "your-project-id",
  token: "your-api-token",
  host: "your-space.signalwire.com"
});

await client.phoneNumbers.setSwmlWebhook("phone-number-id", "https://example.com/swml");
```