Preview: SendMock has no stable release yet. These docs follow develop.
SendMock
Recipes

Two-way SMS

Reply as the contact, have your app's webhook receive it in Twilio's format, and see its TwiML answer in the conversation.

Try it in the demo.

The situation: people answer your SMS: STOP to opt out, YES to confirm, or a question to support. Your app has a webhook for incoming SMS and answers with TwiML. You cannot text your laptop.

You need: your app's incoming SMS webhook URL, and the number your app sends from.

Steps

  1. In Numbers, press Add number: your sending number (for example +15550001111), SMS ticked.
  2. Under Inbound messages, set Webhook URL to your app's handler, Method POST and Format Twilio. Save.
  3. Send an SMS from your app from that number, then open the conversation in SMS.
  4. In Reply as recipient, type STOP and press Send reply.
  5. Your handler gets Twilio's form post (From, To, Body, MessageSid and the X-Twilio-Signature header). If it answers with TwiML <Message>, the answer appears in the conversation with a TwiML reply badge.

In your code

A test that texts STOP to your app's number and waits for your app's answer.

The examples call SendMock's REST API with each language's usual HTTP client and test framework. JavaScript, Go, Java, Rust, Ruby and C# use the small call helper shown under Test helper on their page in Connect your app.

sendmock sms inbound --from +8801700000000 --to +15550001111 --body STOP

answer=$(sendmock sms wait --to +8801700000000 --from +15550001111 --timeout 10s --json)

jq -e '.direction == "outbound"' <<<"$answer" >/dev/null

What you should see

Under the STOP bubble, "Reply webhook 200" (and "1 TwiML reply" if your app answered). Message details > Reply webhook shows the request, your app's response and the parsed TwiML. If your handler failed, Resend reply webhook sends it again after your fix.

Try it in the demo

  1. Open SMS and click the conversation with +8801700000000.
  2. Type Is the shop open? in Reply as recipient and press Send reply.
  3. The demo's app answers with TwiML: "Thanks! We got your message and will get back to you soon." appears with a TwiML reply badge.

Next

On this page