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.

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"

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

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.

Name Description Example Default
Message Body The text you wish to send in your message Hello, and welcome to Twilio! N/A
Send Message From The "from" phone number for this message +15555555551 {{}}
Send Message To The "to" number for the message recipient {{}} {{}}

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

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.

Name Description Example Default
Media URL The URL of media you wish to send with your message. See a list of accepted media content types. N/A
Programmable Chat Service The SID for Chat Service your Flow uses, if any. ISXXXXXXXXXXXXXXXXXXXXX {{trigger.message.InstanceSid}}
Programmable Chat Channel The SID for the Chat Channel your Flow uses, if any. CHXXXXXXXXXXXXXXXXXXXXX {{trigger.message.ChannelSid}}
Message Attributes A 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

Learn more about structurally valid JSON.

Using Programmable Chat with Send Message

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:

curl -X POST \
--data-urlencode "Type=studio" \
--data-urlencode "Configuration.FlowSid=FWxxxxxxxxx" \

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

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

Send Message Variables

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.

Name Liquid 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}}

Example: Hello!

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

Learn more

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:

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!