Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Send Message Widget


Studio uses Widgets to represent various parts of Twilio's functionality 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 Message Widget allows you to send an SMS or chat message to a user from your Studio Flow.

A simple Send Message widget, re-named 'reminder_confirm.' The widget shows a message of 'Great! I'll send a reminder tomorrow'.
(warning)

Warning

If you want to wait for a user's input after a message, use the Send & Wait For Reply Widget instead. The Send Message Widget does not wait for user input before moving on to the next step in the Flow.


Required configuration for Send Message

required-configuration-for-send-message page anchor

The Send Message Widget requires several pieces of information to send messages successfully. A Message Body represents the text sent to the recipient and is not auto-populated.

NameDescriptionExampleDefault
Message BodyThe text you wish to send in your messageHello, and welcome to Twilio!N/A
Send Message FromThe "from" phone number for this message+15555555551{{flow.channel.address}}
Send Message ToThe "to" number for the message recipient{{contact.channel.address}}{{contact.channel.address}}
(information)

Info

The Send Message Widget will, by default, send a message from the phone number connected to your Studio Flow to the user interacting with your Flow. You may choose to override either of these numbers under the Messaging & Chat Config dropdown in the Widget's configuration menu.


Optional configuration for Send Message

optional-configuration-for-send-message page anchor

If using a Programmable Chat Service or Channel to manage communications within your Studio Flow, you may send messages with your Service or Channel instead of an SMS-capable phone number.

NameDescriptionExampleDefault
Media URLThe URL of media you wish to send with your message. See a list of accepted media content types.https://demo.twilio.com/owl.png(link takes you to an external page)N/A
Programmable Chat ServiceThe SID for Chat Service your Flow uses, if any.ISXXXXXXXXXXXXXXXXXXXXX{{trigger.message.InstanceSid}}
Programmable Chat ChannelThe SID for the Chat Channel your Flow uses, if any.CHXXXXXXXXXXXXXXXXXXXXX{{trigger.message.ChannelSid}}
Message AttributesA string metadata field you can use to store any data along with your sent message. If specified, the string value must contain structurally valid JSON.{"date_contacted": {{date: "%Y %h"}}}N/A

Using Programmable Chat with Send Message

using-programmable-chat-with-send-message page anchor

Programmable Chat Service, Channel, and Message attributes only apply to Flows that use Twilio Programmable Chat.

A Chat Service houses all Chat Channels, Messages, Users, and other Chat resources within a Programmable Chat deployment. You can find more information on Chat Services in the Chat Services REST API docs.

Chat Channels represent a chat room and are the center of all Chat activities that take place in a Chat Service. All Chat messages are sent to a user via a Chat Channel. You can read more about Chat Channels in the Chat Channels REST API docs.

Your Studio Flow can receive messages from a user in a Programmable Chat Channel and send messages back using this Send Message Widget. If you want to enable incoming Chat messages in your Flow, you'll need to set your Studio Flow's webhook URL as a Chat Channel webhook.

You can do this in the Webhooks section of the Chat Console for your Chat Service, or via the API. The following is an example of setting a Chat Service webhook via the API with CURL:


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

Once you've configured your Chat Service to use your Flow to handle messages, new messages posted in the Chat Channel will create a new Studio Execution, allowing your Studio Flow to interact with a Chat user.


Send Message Transitions

send-message-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
SentThe message was successfully delivered to the recipient.
Failed to SendThe request to the Messaging API failed and the message could not be sent.

Each outbound message you send with Send Message will store the following variables for use throughout the rest of your Studio Flow. For more information on working with variables in Studio, see this guide.

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

NameLiquid Template Language
Body{{widgets.MY_WIDGET_NAME.outbound.Body}}
From{{widgets.MY_WIDGET_NAME.outbound.From}}
SID{{widgets.MY_WIDGET_NAME.outbound.Sid}}
Status{{widgets.MY_WIDGET_NAME.outbound.Status}}
To{{widgets.MY_WIDGET_NAME.outbound.To}}

The following example shows a Studio Flow that will send a message with the contents "Hello!" whenever a user messages the phone number connected to the Studio Flow.

Twilio Studio Send Message Example.

Want to see how to use the Send Message Widget in a real-world example?

We can't wait to see what you build!


Rate this page: