v77

latestOpenAPI 3.1.0MITraw.githubusercontent.com2026-08-012528701.8 MB
SWML Webhook

SWML inbound call webhook

Payload sent by SignalWire to a SWML calling webhook URL when SWML is fetched for a call. This includes inbound calls arriving on a phone number configured with a SWML calling handler, and outbound REST-initiated calls that point at a SWML URL. The same payload shape is also used when the SWML calling transfer or execute method targets an external URL — in those cases, the params object carries the values supplied to that step.

The webhook URL is expected to respond with the SWML document to execute for the call.

postWebhookinboundCallWebhook

Payload

varsobject required

Script-scope variables for this call session. Empty on the initial document fetch.

envsobject required

Environment variables available to this call's SWML document, which you can reference as ${envs.<key>}. Combines the variables you've configured at the account or project level with any custom_variables you passed on the outbound Call commands request.

Keys are case-sensitive. When a custom_variables key exactly matches an account- or project-level variable, including case, the value from the request wins; if they differ only in case, both are kept as separate variables.

paramsobject required

Parameters passed via a SWML calling execute or transfer step. An empty object on the initial document fetch.

Example payload

{
  "call": {
    "call_id": "c2d3e4f5-a6b7-8901-cdef-234567890abc",
    "node_id": "a1b2c3d4-1111-2222-3333-444455556666",
    "segment_id": "d3e4f5a6-b7c8-9012-defa-345678901bcd",
    "tag": "support-queue",
    "call_state": "created",
    "direction": "inbound",
    "type": "sip",
    "from": "sip:user@example.com",
    "to": "sip:destination@yourdomain.com",
    "from_number": "+12223334444",
    "to_number": "+12223334445",
    "dial_winner": "true",
    "headers": [],
    "parent": {
      "device_type": "phone",
      "call_id": "a1b2c3d4-1111-2222-3333-444455556666",
      "node_id": "a1b2c3d4-1111-2222-3333-444455556666"
    },
    "peer": {
      "call_id": "a1b2c3d4-1111-2222-3333-444455556666",
      "node_id": "a1b2c3d4-1111-2222-3333-444455556666"
    },
    "sip_data": {
      "sip_req_host": "yourdomain.com",
      "sip_req_uri": "destination@yourdomain.com",
      "sip_req_user": "destination",
      "sip_from_host": "example.com",
      "sip_from_uri": "user@example.com",
      "sip_from_user": "user",
      "sip_to_host": "yourdomain.com",
      "sip_to_uri": "destination@yourdomain.com",
      "sip_to_user": "destination",
      "sip_contact_user": "user",
      "sip_contact_port": "5060",
      "sip_contact_uri": "user@192.168.1.100:5060",
      "sip_contact_host": "192.168.1.100",
      "sip_contact_params": {}
    },
    "project_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    "space_id": "d3e4f5a6-b7c8-9012-defa-345678901bcd"
  },
  "vars": {
    "user_selection": "1"
  },
  "envs": {
    "api_key": "<YOUR_API_KEY>",
    "webhook_url": "https://example.com/webhook",
    "id": "12345",
    "case_number": "54321"
  },
  "params": {
    "department": "sales"
  }
}

Response

Webhook received