> This page is for APIs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# 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` (Webhooks.Messaging.InboundMessageContext, required) — The inbound message that triggered this fetch.
- `params` (WebhooksMessagingInboundMessageWebhookPayloadParams, required) — Parameters passed via a SWML messaging `transfer` step. An empty object on the initial document fetch.
- `vars` (WebhooksMessagingInboundMessageWebhookPayloadVars, 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`.

## Types

### Webhooks.Messaging.InboundMessageContext

Information about the inbound message that triggered the SWML document 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 Webhooks.Messaging.InboundMessageMediaItem, required) — MMS media attachments. Empty when the message has no attachments.
- `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.

### WebhooksMessagingInboundMessageWebhookPayloadParams

Parameters passed via a SWML messaging `transfer` step. An empty object on the initial document fetch.

### WebhooksMessagingInboundMessageWebhookPayloadVars

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`.

### Webhooks.Messaging.InboundMessageMediaItem

A single MMS media attachment included on an inbound message.

- `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.