Menu

Expand
Rate this page:

Send & Wait For Reply Widget

Studio uses Widgets to represent various parts of Twilio's API that can then be stitched together in your Studio Flow to build out robust applications that require no coding on your part.

New to Twilio Studio? Check out our Getting Started guide!

The Send & Wait For Reply allows you to send an outgoing message, wait for a reply, and collect the user’s response.

Use this Widget to collect replies to your messages, such as a YES to confirm an appointment or answering survey questions. You can also configure a timeout to wait for the response, after which we will assume "No Reply" and transition accordingly. You can use this to send a followup reminder message, trigger an outgoing voice call, or update your database with no response.

Send & Wait For Reply Widget

Required Configuration for Send & Wait For Reply

The Send & Wait For Reply Widget requires several pieces of information to function properly. You will need to include who the message is being sent to, what the message is, and how long to wait for a reply.

Name Description Default
Message Body The text of the message to send. None
Send Message From The "from" number -- choose one from Phone Number, MessagingServiceSid, OTT Id Flow Default flow.channel.address
Stop Gathering After The number of seconds to wait for a reply. Best practice is to limit the timeout to 4 hours or less. The entire Execution cannot live longer than 30 days due to our data retention policy. 3600 seconds

Optional Configuration for Send & Wait for Reply

The Send & Wait For Reply Widget also accepts a number of configuration options that you can use to send media, or other message attributes.

Name Description Default
Media URL The URL of the media you wish you send out with the message (i.e. https://demo.twilio.com/owl.png) N/A
Programmable Chat Service Only applies for Flows working with Twilio Programmable Chat. A Chat service is where all the Channels, Messages, Users and other resources within a Chat deployment live. See the Chat Services REST API docs for more information. trigger.message.InstanceSid
Programmable Chat Channel Only applies for Flows working with Twilio Programmable Chat. Channels are the center of all chat activity within a Chat Service. Chat messages are sent to a particular channel. See the Chat Channels REST API docs for more information. trigger.message.ChannelSid
Message Attributes Only applies for Flows working with Twilio Programmable Chat. An optional string metadata field you can use to store any data you wish along with the sent message. The string value must contain structurally valid JSON if specified. See the Chat Messages REST API docs for more information. N/A

Note: For a list of fully supported media content types, please see the Accepted Content Types for Media doc.

Using Programmable Chat

Messages from a user in a Programmable Chat Channel can be received by Studio and responded to using the Send & Wait for Reply Widget. To enable incoming Chat messages, add the Studio Flow's webhook URL as a Chat Channel webhook.

Example:

curl -X POST https://chat.twilio.com/v2/Services/ISxxxxxxxx/Channels/CHxxxxxxxxxx/Webhooks \
--data-urlencode "Type=studio" \
--data-urlencode "Configuration.FlowSid=FWxxxxxxxxx" \
-u ACCOUNT_SID:AUTH_TOKEN

New messages posted in the Chat Channel will create a new Studio Execution, enabling the Studio Flow to interact with the Chat user.

Send & Wait For Reply Transitions

These events trigger transitions from this Widget to another Widget in your Flow. For more information on working with Studio transitions, see this guide.

Name Description
Reply Contact successfully replied.
No Reply Contact did not reply.
Delivery Fails The message could not be delivered.

Send & Wait For Reply Variables

When the Send & Wait For Reply Widget executes, it will have stored the following variables for use throughout your Studio Flow (where MY_WIDGET_NAME is the name of your actual widget). For more information on working with variables in Studio, see this guide.

Find definitions and examples for these variables at the Message Resource page.

Outbound Variables

The message Studio sent to the user.

Name Liquid Template Language
Body {{widgets.MY_WIDGET_NAME.outbound.Body}}
From (Studio Flow) {{widgets.MY_WIDGET_NAME.outbound.From}}
SID {{widgets.MY_WIDGET_NAME.outbound.Sid}}
Status {{widgets.MY_WIDGET_NAME.outbound.Status}}
To (User) {{widgets.MY_WIDGET_NAME.outbound.To}}

Inbound Variables

The message sent by the user.

Name Liquid Template Language
Body {{widgets.MY_WIDGET_NAME.inbound.Body}}
From (User) {{widgets.MY_WIDGET_NAME.inbound.From}}
MediaUrl{N} {{widgets.MY_WIDGET_NAME.inbound.MediaUrl0}}
SID {{widgets.MY_WIDGET_NAME.inbound.Sid}}
To (Studio Flow) {{widgets.MY_WIDGET_NAME.inbound.To}}

If more than one media element is indicated by NumMedia then MediaUrl{N} will be used, where N is the zero-based index of the Media (e.g. MediaUrl0)

Example: an SMS Prompt

In the following example, we have asked the user if they are enjoying their time creating Flows with Twilio Studio using the Send & Wait For Reply Widget. We've named the Widget first_message. Our Flow will wait for a reply from the user and then send them another message using the Send Message Widget named first_reply, once they respond.

If they don't respond, our Flow will use the Send Message Widget named no_reply_response to follow up with the user.

Send and Wait For Reply example with "no reply" configuration

You can even extend this Studio Flow by adding some conditional logic based on how the user responds with the Split Based On... Widget. Head over to the Split Based On... Widget documentation to learn more!

Learn More

Now that you know the basics of the Send & Wait For Reply Widget, you may want to dig into the Liquid Templating Language. We also have step-by-step tutorials that will show you how to implement the Send & Wait For Reply Widget in Studio:

We can't wait to see what you build!

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

        
        
        

        Thank you for your feedback!

        Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more