メニュー

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.

名前 概要 初期値
Message Body The text you wish to send in your message Hello, and welcome to Twilio! 該当なし
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}}

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.

名前 概要 初期値
MediaUrl The URL of media you wish to send with your message. See a list of accepted media content types. https://demo.twilio.com/owl.png 該当なし
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"}}} 該当なし

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

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

名前 概要
Sent The message was successfully delivered to the recipient.
Failed to Send The message was not delivered to the recipient.

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.

名前 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

さらに詳しく

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

皆さまが何を開発されるのか、目にするのが待ちきれません!

ページを評価:

ヘルプが必要ですか?

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.

フィードバックくださりありがとうございます!

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!

ステップ1

Get link

Get a free personal referral link here

ステップ2:

Give $10

Your user signs up and upgrade using link

ステップ3

Get $10

1,250 free SMSes
OR 1,000 free voice mins
OR 12,000 chats
OR more