Also called SMS autoresponder, two-way SMS, SMS keyword reply
sms
The claim
Inbound messaging is a webhook that returns a messaging SWML document. The reply verb answers the sender on the number they texted; an inline switch branches the body on a keyword with no server at all. The Python surface does the same branching in code and shows where MMS attachments arrive.
How it works
Markup only: the whole handler is one document.
- reply:
switch:
variable: message.body
transform: lowercase_trim
case:
hours: "We are open Monday to Friday, nine to five, Eastern time."
help: "Text HOURS for opening hours, or STOP to unsubscribe."
stop: "You have been unsubscribed and will receive no more messages."
default: "Thanks for your message. A person will reply shortly."
Python: SignalWire POSTs the documented inbound-message payload (message.from, message.to, message.body, message.media[] with url and content_type) and executes whatever document the handler returns:
Attachments on an MMS are URLs in message.media; download them from the handler. reply can also attach media to answer with an MMS, and takes a status_url for delivery callbacks (see send-an-sms for handling those).
*STOP is your job.* SignalWire does not manage opt-outs; the handler records the sender so nothing is sent to them later. The full pattern is handle-opt-outs-yourself.
What to change first
Replace the static replies with run-the-same-agent-over-text: forward the body to the AI Chat API and reply with the agent’s answer.