Skip to contentSkip to navigationSkip to topbar
On 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.

(information)

Info

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

required-configuration-for-send--wait-for-reply page anchor

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.

NameDescriptionDefault
Message BodyThe text of the message to send.None
Send Message FromThe "from" number — choose one from Phone Number, MessagingServiceSid, OTT IdFlow Default flow.channel.address
Stop Gathering AfterThe 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

optional-configuration-for-send--wait-for-reply page anchor

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

NameDescriptionDefault
Media URLThe URL of the media you wish you send out with the message (i.e. https://demo.twilio.com/owl.png(link takes you to an external page))N/A
Programmable Chat ServiceOnly 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 ChannelOnly 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 AttributesOnly 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
(information)

Info

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

Chat Services REST API docs: https://www.twilio.com/docs/chat/rest/services

Chat Channels REST API docs: https://www.twilio.com/docs/chat/rest/channels

Chat Messages REST API docs: https://www.twilio.com/docs/chat/rest/messages


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:

1
curl -X POST https://chat.twilio.com/v2/Services/ISxxxxxxxx/Channels/CHxxxxxxxxxx/Webhooks \
2
--data-urlencode "Type=studio" \
3
--data-urlencode "Configuration.FlowSid=FWxxxxxxxxx" \
4
-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

send--wait-for-reply-transitions page anchor

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

NameDescription
ReplyContact successfully replied.
No ReplyContact did not reply.
Delivery FailsThe message could not be delivered.

Send & Wait For Reply Variables

send--wait-for-reply-variables page anchor

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

outbound-variables page anchor

The message Studio sent to the user.

NameLiquid 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}}

The message sent by the user.

NameLiquid 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.MessageSid}}
To (Studio Flow){{widgets.MY_WIDGET_NAME.inbound.To}}
(information)

Info

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). Note that this behavior does not apply for WhatsApp Channels, and only one image will be accessible.


Example: an SMS Prompt

example-an-sms-prompt page anchor

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!


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!

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.