Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Send & Wait For Reply

Send & Wait For Reply Widget

Description:

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.

Required Configuration

Name

Description

Default

Message Body

The text of the message to send.

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

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)

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.

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.

Variables:

The following variables will be added to the Execution context (where MY_WIDGET_NAME is the name of your actual widget):

outbound [The message Studio sent to the user]:

Sid

widgets.MY_WIDGET_NAME.outbound.Sid

To

widgets.MY_WIDGET_NAME.outbound.To

From

widgets.MY_WIDGET_NAME.outbound.From

Body

widgets.MY_WIDGET_NAME.outbound.Body

Status

widgets.MY_WIDGET_NAME.outbound.Status

ErrorCode

widgets.MY_WIDGET_NAME.outbound.ErrorCode

ErrorMessage

widgets.MY_WIDGET_NAME.outbound.ErrorMessage

inbound [The response message the user sent back to Studio]:

Sid

widgets.MY_WIDGET_NAME.inbound.Sid

To

widgets.MY_WIDGET_NAME.inbound.To

From

widgets.MY_WIDGET_NAME.inbound.From

Body

widgets.MY_WIDGET_NAME.inbound.Body

MediaUrl{N}

widgets.MY_WIDGET_NAME.inbound.MediaUrl0

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

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 browsing the Twilio tag on Stack Overflow.