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

# SWML inbound message webhook

POST 

Payload sent by SignalWire to a SWML messaging webhook URL when an inbound SMS or MMS message arrives on a phone number configured with a SWML message handler. The same payload shape is also used when the SWML messaging `transfer` method targets an external URL — in that case, `params` carries the values supplied to the `transfer` step and `vars` carries the propagated runtime variables from the originating document.

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

Reference: https://signalwire.com/docs/apis/rest/webhooks/inbound-message-webhook

## Request

### Payload

- `message` (object, required) — The inbound message that triggered this fetch.
  - `message_id` (string, required) — Unique identifier for the inbound message.
  - `project_id` (string, required) — The Project ID this message belongs to.
  - `space_id` (string, required) — The Space ID this message belongs to.
  - `direction` (enum, required) — Direction of the message. Always `inbound` for messages handled by an SWML messaging script.
    - Allowed values: `inbound`
  - `type` (enum, required) — The kind of message.
    - Allowed values: `sms`, `mms`
  - `from` (string, required) — Phone number that sent the message.
  - `to` (string, required) — Phone number that received the message.
  - `body` (string, required, nullable) — The text content of the message. Null on media-only MMS where the carrier did not include a text body.
  - `media` (list of object, required) — MMS media attachments. Empty when the message has no attachments.
    - `url` (string, required) — URL to download the media file.
    - `content_type` (string, required) — MIME type of the media file.
    - `size` (integer, required) — File size in bytes.
  - `segments` (integer, required) — Number of SMS segments the message body was split into.
  - `timestamp` (datetime, required) — Timestamp in UTC (ISO 8601, seconds precision) of when the message was received.
- `params` (object, required) — Parameters passed via a SWML messaging `transfer` step. An empty object on the initial document fetch.
- `vars` (object, optional) — Script-scope variables propagated from the SWML document that issued a `transfer` step. Absent on the initial inbound-message fetch; present (possibly empty) on fetches driven by a `transfer` step inside a full-mode SWML document. Common keys include `request_result`, `request_response`, `request_response_code`, `request_response_body`, `reply_result`, and `reply_message_id`.