SWML Webhook

Create SWML webhook

Creates a resource that requests calling or messaging SWML from your server when the handler runs. Use it when instructions must be generated from current application state; use Create SWML Script when the SWML can be stored in SignalWire, or Create cXML webhook when the server returns cXML.

Permissions

The API token used to authenticate must have the following scope(s) enabled to make a successful request: Voice, Messaging, Fax, or Video.

Learn more about API scopes.

post/api/fabric/resources/swml_webhooks

Request body

namestring

Name of the SWML Webhook.

used_for'calling' | 'messaging'

Indicates whether this SWML Webhook handles inbound calls or inbound messages. Determines the payload SignalWire POSTs to primary_request_url.

primary_request_urlstring uri required

Primary URL SignalWire fetches the SWML document from when the webhook fires. The webhook payload depends on used_for: for calling, see the SWML inbound call webhook; for messaging, see the SWML inbound message webhook.

primary_request_method'GET' | 'POST'

The method type to use for the URL

fallback_request_urlstring uri

Fallback URL SignalWire fetches the SWML document from if the primary URL fails. Receives the same payload as primary_request_url — see the SWML inbound call webhook or SWML inbound message webhook depending on used_for.

fallback_request_method'GET' | 'POST'

The method type to use for the URL

status_callback_urlstring uri

URL to receive message status callback events for outbound messages sent by this webhook (reply or send_sms). See the Message status callback webhook for the payload your URL will receive.

status_callback_method'GET' | 'POST'

The method type to use for the URL

Example request

{
  "name": "My SWML Webhook",
  "used_for": "calling",
  "primary_request_url": "https://primary.com",
  "fallback_request_url": "https://fallback.com",
  "status_callback_url": "https://callback.com"
}

Response

The request has succeeded and a new resource has been created as a result.

idstring uuid required

Universal Unique Identifier.

project_idstring uuid required

Universal Unique Identifier.

display_namestring required

Display name of the SWML Webhook Fabric Resource

type'swml_webhook' required

Type of the Fabric Resource

created_atstring date-time required

Date and time when the resource was created.

updated_atstring date-time required

Date and time when the resource was updated.

Example response

{
  "display_name": "Booking Assistant",
  "type": "swml_webhook",
  "created_at": "2024-05-06T12:20:00Z",
  "updated_at": "2024-05-06T12:20:00Z",
  "swml_webhook": {
    "name": "My SWML Webhook",
    "used_for": "calling",
    "primary_request_url": "https://primary.com",
    "fallback_request_url": "https://fallback.com",
    "status_callback_url": "https://callback.com"
  }
}

Changes

No changes found, but 3 of the 137 revisions have a changelog that could not be searched — this endpoint may have changed in one of them.