reply
Create and send an outbound message in response to the inbound message. reply accepts three
shapes: a string shorthand, an object with body/media/routing fields, or an inline switch that
branches the reply body on a variable’s value.
reply does not end execution — subsequent steps in the section continue to run after the reply
is queued.
Properties
reply accepts one of three shapes — use whichever fits the document shape:
String shorthand
Object
Inline switch
A single string used as the reply body. The reply is sent to the inbound
message’s from number, using the inbound to as the sender.
reply
The body of the reply message. After variable expansion it must contain at least one
non-whitespace character. Body length is checked before the reply is queued. The limit depends on
the route SignalWire uses to send the reply, and length is counted according to the message
encoding. A body over the limit fails the reply with a swml_reply_character_limit_exceeded
error whose message states the limit.
Variables
reply writes these variables into the script context after it runs. Read them with the
%{variable} syntax in subsequent steps. When reply is called multiple times in a single
document, both variables reflect the most recent successful reply. If a reply can’t be queued,
execution stops, so no later step runs.
reply_result
Outcome of queuing the reply. queued when the outbound message was accepted and queued for
sending; failed when it couldn’t be queued (invalid from/to, missing body and media,
character limit exceeded, missing messaging capability, inactive campaign, etc.). This value
doesn’t report what happens to the message after it is queued — use
status callbacks or the
message logs to track delivery.
reply_message_id
ID of the outbound message created by the most recent successful reply. It matches the id in
that reply’s status callbacks. A failed reply doesn’t set or clear it.
Status callbacks
Status callbacks are asynchronous, best-effort HTTP notifications: delivery can be delayed or fail silently — if your server is unreachable, the callback simply never arrives. Don’t gate time-critical or business-critical actions solely on receiving one. Confirm state via the REST API before acting, or use a transport with visible failure modes — see Status callback reliability.
The status_url on reply registers a delivery status callback for the outbound reply message —
not for the inbound message that triggered the SWML document. It behaves the same way as the status
callback on any other outbound message sent through SignalWire.
- Fires as the outbound reply moves through delivery states, starting with a
queuedcallback when the reply is queued. - Callback delivery is independent of SWML execution:
replyqueues the outbound message and execution continues with the next step. Callbacks have no guaranteed order relative to the document’s remaining steps. - If
replyis called multiple times in a single document, each reply’sstatus_urlis registered independently for its own outbound message.
When status_url is set, SignalWire sends an HTTP POST to that URL each time the outbound reply
transitions to a new state. The callback uses the same payload as other outbound messages sent
through SignalWire.
See the Message status callback
webhook page for the full field reference and the list of possible status values.
Examples
Reply with body
Reply with media (MMS)
Reply with a status callback URL
Keyword-driven reply with inline switch
The inline switch form branches the reply body on a variable’s value — typically the
inbound message.body.
Per-case media and routing with inline switch
When a case needs more than a body string — different media, a different destination, or a
per-branch status_url — supply a full reply object for that case instead of a bare string.