Menu

Expand
Rate 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.

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. You can use this Widget to send messages to users before any other action occurs.

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 request a user’s input after a message, we recommend that you use the Send & Wait For Reply Widget instead.

Required configuration for Send Message

The Send Message Widget requires several pieces of information to send messages successfully.

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 {{flow.channel.address}}
Send Message To The "to" number for the message recipient {{contact.channel.address}} {{contact.channel.address}}

Note that, by default, the Send Message Widget will 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.

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 https://demo.twilio.com/owl.png 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

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

The Send Message Widget can be configured to handle two different transitions depending on if your message was sent successfully: sent and failed to send. You can configure these transitions to lead to any other Widget in your Studio Flow.

For more information on working with Studio transitions, see this guide.

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.

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

For more information on working with variables in Studio, see this guide.

Learn more

Want to see how to use the Send Message Widget in a real-world example? Follow along with this tutorial that shows how to set up an SMS auto-responder with Twilio Studio to see it in action.

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