Trigger (Start) 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 Trigger (Start) Widget begins each unique Studio Flow, and allows your Flow to respond to an incoming message, call, or a Flow initiated with the Studio REST API. You cannot delete this Widget from your Flow.
This Widget begins your Studio Flow and will route inbound communication to any Widget you attach to it.
Required Configuration for Trigger (Start)
The Trigger (Start) Widget requires several pieces of information to function properly. All required fields are auto-populated for you by Studio, but you can change them if you need to.
Name | Description | Example | Default |
---|---|---|---|
Flow Name | The name of this Studio Flow. | Sales Team IVR | This field defaults to the name you entered when you created this Flow through the Twilio console. |
Webhook URL | The URL for this Studio Flow. | https://webhooks.twilio.com/v1/Accounts/<account_sid>/Flows/<flow_sid> | This field is auto-populated and cannot be changed. |
Rest API URL | The URL you can POST to to trigger an execution. | https://studio.twilio.com/v2/Flows/<flow_sid>/Executions | This field is auto-populated and cannot be changed. |
You may wish to copy the Flow URL to the clipboard to connect it to a Twilio number or make REST API requests.
Trigger (Start) 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 |
---|---|
Incoming Call | An incoming call has initiated execution of the Flow. |
Incoming Message | An incoming message has initiated execution of the Flow. |
REST API | An incoming REST API request has initiated execution of the Flow. |
Incoming Conversation | An incoming Conversation has initiated execution of the Flow. |
You must connect at least one Widget to at least one of these Triggers for your Studio Flow to work. The Trigger Widget does not allow custom Transition events.
Trigger (Start) Variables
When the Trigger (Start) Widget executes, it will have stored the following variables for use throughout your Studio Flow. Depending on which inbound Trigger you use (Message, Call, Conversation, or REST API), a set of variables will be made available for use throughout your Studio Flow. For more information on working with variables in Studio, see this guide.
Incoming Message Trigger Variables
Find definitions and examples for these variables at the Message Resource page.
Name | Liquid Template Language |
---|---|
Account SID | {{trigger.message.AccountSid}} |
Body | {{trigger.message.Body}} |
From (User) | {{trigger.message.From}} |
From City | {{trigger.message.FromCity}} |
From Country | {{trigger.message.FromCountry}} |
From State | {{trigger.message.FromState}} |
From ZIP | {{trigger.message.FromZip}} |
Message SID | {{trigger.message.MessageSid}} |
Messaging Service SID | {{trigger.message.MessagingServiceSid}} |
Media URL | {{trigger.message.MediaUrl{N}}} |
Number of Media Items | {{trigger.message.NumMedia}} |
To (Studio Flow Phone Number) | {{trigger.message.To}} |
To City | {{trigger.message.ToCity}} |
To Country | {{trigger.message.ToCountry}} |
To State | {{trigger.message.ToState}} |
To ZIP | {{trigger.message.ToZip}} |
The Media URL variable is used by specifying the index of the media element you want to access. For example, if a single media element was sent in the incoming message, the variable {{trigger.message.MediaUrl0}}
can be used to access the URL where the media element is hosted.
Incoming Call Trigger Variables
Find definitions and examples for these variables at the Call Resource page.
Name | Liquid Template Language |
---|---|
Account SID | {{trigger.call.AccountSid}} |
API Version | {{trigger.call.ApiVersion}} |
Called (Studio Flow Phone Number) | {{trigger.call.Called}} |
Caller (User) | {{trigger.call.Caller}} |
Call Status | {{trigger.call.CallStatus}} |
Direction | {{trigger.call.Direction}} |
From (User) | {{trigger.call.From}} |
From City | {{trigger.call.FromCity}} |
From Country | {{trigger.call.FromCountry}} |
From State | {{trigger.call.FromState}} |
From ZIP | {{trigger.call.FromZip}} |
Caller City | {{trigger.call.CallerCity}} |
Caller Country | {{trigger.call.CallerCountry}} |
Caller State | {{trigger.call.CallerState}} |
Caller ZIP | {{trigger.call.CallerZip}} |
Call SID | {{trigger.call.CallSid}} |
Called City | {{trigger.call.CalledCity}} |
Called Country | {{trigger.call.CalledCountry}} |
Called State | {{trigger.call.CalledState}} |
Called ZIP | {{trigger.call.CalledZip}} |
To (Studio Flow Phone Number) | {{trigger.call.To}} |
To City | {{trigger.call.ToCity}} |
To Country | {{trigger.call.ToCountry}} |
To State | {{trigger.call.ToState}} |
To ZIP | {{trigger.call.ToZip}} |
Incoming Conversation Trigger Variables
Find definitions and examples for these variables at the Conversation Resource page.
Name | Liquid Template Language |
---|---|
Account SID | {{trigger.conversation.AccountSid}} |
Body | {{trigger.conversation.Body}} |
Channel SID | {{trigger.conversation.ChannelSid}} |
Conversation SID | {{trigger.conversation.ConversationSid}} |
Date Created | {{trigger.conversation.DateCreated}} |
From (Conversation) | {{trigger.conversation.From}} |
Message SID | {{trigger.conversation.MessageSid}} |
Messaging Service SID | {{trigger.conversation.MessagingServiceSid}} |
REST API Trigger Variables
Variables passed in via REST API trigger will be available as Flow Data and accessible via {{flow.data.MY_CUSTOM_VARIABLE}}
syntax. See the REST API page for more details.
Example: Trigger a Flow from an inbound message with Trigger (Start)
Every Flow you create will start with a Trigger (Start) Widget. The screenshot below shows how this Widget looks when connected to a Send & Wait for Reply Widget, beginning a Flow that takes users through a simple SMS survey.
Learn More
Now that you know the basics of the Trigger (Start) Widget, why not learn how to build a complete Studio Flow? You can follow along with any of the following tutorials to see this Widget in action:
- Learn how to use the REST API trigger with the Conduct an SMS survey with Studio tutorial.
- Learn how to use the Incoming Call Trigger with the Build an phone call IVR with Studio tutorial.
- Learn how to use the Incoming Message Trigger with the Set up an SMS auto-responder with Studio tutorial.
- Learn how to use Studio with Conversations.
We can't wait to see what you build!
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.