Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now

メニュー

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Widgetライブラリー

This page documents all of the widgets available in the Studio drag and drop environment. New to Studio and want to learn about it? Jump to the Usage guide homepage!

Widgetライブラリー

現在使用できるWidget:

💥 Trigger (Start)

Studio Trigger Widget

説明:

すべてのFlowはTrigger Widgetを持っています。 これはFlowの開始となるWidgetです。 他のWidgetは着信通話、REST API、そして受信メッセージという3つの取りうるトリガーイベントの内ひとつに接続されます。 このWidgetは削除できません。

必須の構成:

Flow Name is required, and defaults to the name entered when you create the Flow. You may modify this at any time.

FlowのWebhook URL (読み取り専用) です。 下記の形式で構成パネルに表示されます:

https://webhooks.twilio.com/v1/Accounts/<account_sid>/Flows/<flow_sid>

クリップボードにFlowのURLをコピーして、これをTwilio電話番号に接続したり、REST APIリクエストを送信したりできます。

Transitions: Trigger Widgetに接続される3つの初期イベントがあります。 着信通話、受信メッセージ、およびREST API(受信リクエスト)の3つです。 Trigger WidgetではカスタムTransitionイベントは認められていません。

変数:

Inbound Message(受信メッセージ) Trigger

Account SID trigger.message.AccountSid
Body trigger.message.Body
From trigger.message.From
FromCity trigger.message.FromCity
FromCountry trigger.message.FromCountry
FromState trigger.message.FromState
FromZip trigger.message.FromZip
Message SID trigger.message.MessageSid
Messaging Service SID trigger.message.MessagingServiceSid
Number of Media Items trigger.message.NumMedia
To trigger.message.To
ToCity trigger.message.ToCity
ToCountry trigger.message.ToCountry
ToState trigger.message.ToState
ToZip trigger.message.ToZip

Inbound Call(着信通話) Trigger

Account SID trigger.call.AccountSid
ApiVersion trigger.call.ApiVersion
Called trigger.call.Called
caller trigger.call.Caller
CallStatus trigger.call.CallStatus
Direction trigger.call.Direction
From trigger.call.From
FromCity trigger.call.FromCity
FromCountry trigger.call.FromCountry
FromState trigger.call.FromState
FromZip 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 trigger.call.To
ToCity trigger.call.ToCity
ToCountry trigger.call.ToCountry
ToState trigger.call.ToState
ToZip trigger.call.ToZip

REST API Trigger

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.

⚙ Send & Wait For Reply

Send & Wait For Reply Widget

説明:

Send & Wait For Reply allows you to send an outgoing message, wait for a reply, and collect the user’s response. Use this Widget to collect replies to your messages, such as a YES to confirm an appointment or answering survey questions. You can also configure a timeout to wait for the response, after which we will assume "No Reply" and transition accordingly. You can use this to send a followup reminder message, trigger an outgoing voice call, or update your database with no response.

必須の構成

名前

概要

初期値

Message Body

送信するメッセージのテキストです。

Send Message From

「From」番号です。 From電話番号、MessagingServiceSid、OTT Idからひとつ選択します

Flow Default flow.channel.address

Stop Gathering After

The number of seconds to wait for a reply. Best practice is to limit the timeout to 4 hours or less. The entire Execution cannot live longer than 90 days due to our data retention policy.

3600 seconds

オプションの構成

名前

概要

初期値

MediaUrl

The URL of the media you wish you send out with the message (i.e. https://demo.twilio.com/owl.png)

Programmable Chat Service

Only applies for Flows working with Twilio Programmable Chat. A Chat service is where all the Channels, Messages, Users and other resources within a Chat deployment live. See the Chat Services REST API docs for more information.

trigger.message.InstanceSid

Programmable Chat Channel

Only applies for Flows working with Twilio Programmable Chat. Channels are the center of all chat activity within a Chat Service. Chat messages are sent to a particular channel. See the Chat Channels REST API docs for more information.

trigger.message.ChannelSid

Message Attributes

Only applies for Flows working with Twilio Programmable Chat. An optional string metadata field you can use to store any data you wish along with the sent message. The string value must contain structurally valid JSON if specified. See the Chat Mesages REST API docs for more information.

Using Programmable Chat:

Messages from a user in a Programmable Chat Channel can be received by Studio and responded to using the Send & Wait for Reply widget. To enable incoming Chat messages, add the Studio Flow's webhook URL as a Chat Channel webhook.

例:

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

New messages posted in the Chat Channel will create a new Studio Execution, enabling the Studio Flow to interact with the Chat user.

変数:

The following variables will be added to the Execution context (where MY_WIDGET_NAME is the name of your actual widget):

outbound [Studioがエンドユーザーに送信するメッセージ]:

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

ErrorCode

widgets.MY_WIDGET_NAME.outbound.ErrorCode

ErrorMessage

widgets.MY_WIDGET_NAME.outbound.ErrorMessage

inbound [エンドユーザーがStudioに返送する応答メッセージ]:

Sid

widgets.MY_WIDGET_NAME.inbound.Sid

To

widgets.MY_WIDGET_NAME.inbound.To

From

widgets.MY_WIDGET_NAME.inbound.From

Body

widgets.MY_WIDGET_NAME.inbound.Body

MediaUrl{N}

widgets.MY_WIDGET_NAME.inbound.MediaUrl0

MediaContentType{N}が使用されるのではなく、NumMediaによって複数のメディア要素が含まれている場合、Nはメディアの0で始まるインデックス値となります(たとえば、MediaUrl0となります。)



⚙Split Based On...

Split Based On... Widget

説明:

Split Based On...を使用すると、Flowを分割してユーザーの条件に基づいて特定のWidgetに接続できます。 このWidgetを使用して、ユーザーがSMSに対して「はい」と返信したり、通話中にプッシュボタンの「1」を押したり、といった条件を扱います。

メモ: Studioの条件は大文字と小文字を区別せず、値の前後の空白文字は自動的に切り詰められます。

必須の構成:

名前

概要

初期値

Variable To Test

テストに使用する値(または式)です。

たとえば、メッセージ本文で分岐させたい場合、入力はメッセージ内に保存する変数になります。

ドロップダウンから定義済みの変数を選択するか、中括弧でくくって動的な変数を直接入力します: {{widgets.http_1.parsed.foo}}

{{widgets.send_message_1.message.Body}}

該当なし



Transitions:

You’ll define the event(s) that trigger transitions from this Widget. You get No Match for free once you set a branch.

名前

概要

初期値

Condition Matches

例: テキストが「はい」と一致した際の「YES」

NEW TRANSITION

noMatch

入力がユーザー定義の条件のどれとも一致しなかった

noMatch

条件は「subject (主語) predicate (述語) [value (値)]の形式を取り、右側のパネルで設定できます。

subject: 入力として定義された構成パラメーターです。

predicate: 使用する演算子です -- 等号、大なりイコール、などです。

[value]: 比較対象の値です。 定数、変数、および式がサポートされます。 値は「blank」や「has any value」といった特定の条件に対してnullに設定できます。

下記の例では、ユーザーに対してリマインダーを受信したいかどうか尋ねます。 Send & Wait For Reply Widgetの後続は、ユーザーのレスポンスを評価するSplit Based On... Widgetです。

3つの条件があります:

  1. プロンプト時にユーザーが「Y(YES)」を入力する
  2. プロンプト時にユーザーが「N(NO)」を入力する
  3. ユーザーが他の値を入力する(NO MATCH)

Subject (主語)

Predicate (述語)

{{widgets.reminders_response.inbound.Body}}

Equals

Y

{{widgets.reminders_response.inbound.Body}}

Equals

N

条件「YES」は、REMINDERS_CONFIRMという名前のSend SMS Widgetへの遷移 (Transition) し、一方「NO」および「NO MATCH」の条件はREMINDERS_OPTOUTという名前のSend SMS WidgetにTransitionします。

その他の条件についての使用例をいくつかご紹介します:

Subject (主語)

Predicate (述語)

{{flow.data.appointment_date}}

Is After Date

2017-09-04

{{flow.data.appointment_time}}

Is Before Time 16:35

{{flow.data.reward_points}}

Greater Than

1000

{{flow.data.first_name}}

Is Blank

{{trigger.message.Body}}

Matches Any Of yes,yeah,yup

{{flow.data.survey_result}}

Regex

[1-5]

Note: Omit leading and trailing slashes. Matching is case-insensitive.



⚙ Send Message

Send Message Widget

説明:

Send Messageを使用するとユーザーに対してメッセージを送信できます。このWidgetを使用して他のアクションに先立ってユーザーにメッセージを送信します。メッセージの後にユーザーからの入力をリクエストしたい場合は、代わりにSend & Wait For Reply Widgetを使用します。

必須の構成

名前

概要

初期値

Message Body

送信するメッセージのテキストです。

Send Message From

「From」番号です。 From電話番号、MessagingServiceSid、OTT Idからひとつ選択します

Flow Default flow.channel.address

Send Message To

The "to" number, or recipient of the message

Flow Default contact.channel.address

オプションの構成

名前

概要

初期値

MediaUrl

The URL of the media you wish you send out with the message (i.e. https://demo.twilio.com/owl.png)

Programmable Chat Service

Only applies for Flows working with Twilio Programmable Chat. A Chat service is where all the Channels, Messages, Users and other resources within a Chat deployment live. See the Chat Services REST API docs for more information.

trigger.message.InstanceSid

Programmable Chat Channel

Only applies for Flows working with Twilio Programmable Chat. Channels are the center of all chat activity within a Chat Service. Chat messages are sent to a particular channel. See the Chat Channels REST API docs for more information.

trigger.message.ChannelSid

Message Attributes

Only applies for Flows working with Twilio Programmable Chat. An optional string metadata field you can use to store any data you wish along with the sent message. The string value must contain structurally valid JSON if specified. See the Chat Mesages REST API docs for more information.

Using Programmable Chat:

Messages from a user in a Programmable Chat Channel can be received by Studio and responded to using the Send Message widget. To enable incoming Chat messages, add the Studio Flow's webhook URL as a Chat Channel webhook.

例:

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

New messages posted in the Chat Channel will create a new Studio Execution, enabling the Studio Flow to interact with the Chat user.

変数:

発信

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

⚙ Say/Play

say/play widget

説明:

Say/Playを使用すると、通話中のユーザーに録音済みメッセージを再生したり、テキストを読み上げたりできます。 このWidgetを使用して後続のアクションに先立ってユーザーに対して情報を読み上げたり再生したりします。 メッセージの後にユーザーに入力を要求したい場合は、代わりにGather Widgetを使用してください。

条件付き構成

下記のうちどれかひとつが必須です:

名前

概要

初期値

Say or Play Message

録音済みのメッセージをー再生するか、テキストを読み上げるかを選択します。

say

オプションの構成

名前

概要

初期値

Text To Say

(Sayの場合)読み上げるテキストです。 テンプレートがサポートされており、「こんにちは、{{first_name}}」といったような読み上げが可能です。

ヒント: 空白文字に囲まれたピリオドを追加すると、以下のようにスピーチに一時停止を追加します: 「Hello . . . {{first_name}}」。 およそ15個の空白で囲まれたピリオドは1秒間の無音に相当します。

Message Voice

(Sayの場合)ドロップダウンから希望する声を選択します。

Alice

URL of Audio File

(Playの場合)再生するメディアのURLです。 https://api.twilio.com/cowbell.mp3 などです。

サポートされるMIMEタイプ: <Play>

Language

(Sayの場合)ドロップダウンから希望する言語を選択します。

en

Number of Loops

メッセージのループ回数を選択します。

1




⚙ Gather Input On Call

Gather input on call widget

説明:

Gather Input On Call allows you to gather a user’s input while they are on call. Use this Widget to collect DTMF information. This can then be saved (great for collecting data) or sent to another Widget (such as a Split Based On... Widget) to send the user down the right path.

Gather Widgetには必須の構成はありません。

オプションの構成

名前

概要

サポートされる値

初期値

Say or Play a Message

録音済みのメッセージを再生するか、テキストを読み上げるかを選択します)Say/Playと同様です)。

Say a Message、Play a Message

メッセージを読み上げる

Text To Say

(Sayの場合)読み上げるテキストです。 テンプレートがサポートされており、「こんにちは、{{first_name}}」といったような読み上げが可能です。

Language

(if Say) Language and regional dialect for the message being said.

See dropdown list on the widget

en

Message Voice

(Sayの場合)ドロップダウンから希望する声を選択します。

Varies based on language selected

Alice

URL of Audio File

(Playの場合)再生するメディアのURLです。 https://api.twilio.com/cowbell.mp3 などです。

Number of Loops

メッセージのループ回数を選択します。

1

Stop Gathering After ___ Seconds

Time to wait for the caller to press a key.

1秒〜30秒

5秒

Speech Recognition Language

Language the speech engine will try to recognize.

See complete list en-US

Speech Recognition Hints

カンマで区切られたヒントの値の一覧です。

Stop Gathering On Keypress?

If Twilio should listen for a specific keypress to stop gathering digits. If set to "No," all keypresses will be gathered and submited once the the Stop Gathering After timeout is reached or the expected Number of Digits are collected.

Yes/No

はい

Stop Gathering On Keypress ___

A value that will submit the received data as soon as it’s pressed. Note: This is a control key and its value is not submitted with the rest of the gathered digits.

0〜9、#、* または空白文字

#

Stop Gathering After Number Of Digits

想定している数字の数であり、(押されたプッシュボタンが)その回数に達するとただちに送信を行います。

0〜9 または空白文字



変数:

Account SID widgets.MY_WIDGET_NAME.AccountSid
ApiVersion widgets.MY_WIDGET_NAME.ApiVersion
Called widgets.MY_WIDGET_NAME.Called
caller widgets.MY_WIDGET_NAME.Caller
CallStatus widgets.MY_WIDGET_NAME.CallStatus
Direction widgets.MY_WIDGET_NAME.Direction
From widgets.MY_WIDGET_NAME.From
FromCity widgets.MY_WIDGET_NAME.FromCity
FromCountry widgets.MY_WIDGET_NAME.FromCountry
FromState widgets.MY_WIDGET_NAME.FromState
FromZip widgets.MY_WIDGET_NAME.FromZip
Caller City widgets.MY_WIDGET_NAME.CallerCity
Caller Country widgets.MY_WIDGET_NAME.CallerCountry
Caller State widgets.MY_WIDGET_NAME.CallerState
Caller ZIP widgets.MY_WIDGET_NAME.CallerZip
Call SID widgets.MY_WIDGET_NAME.CallSid
Called City widgets.MY_WIDGET_NAME.CalledCity
Called Country widgets.MY_WIDGET_NAME.CalledCountry
Called State widgets.MY_WIDGET_NAME.CalledState
Called ZIP widgets.MY_WIDGET_NAME.CalledZip
To widgets.MY_WIDGET_NAME.To
ToCity widgets.MY_WIDGET_NAME.ToCity
ToCountry widgets.MY_WIDGET_NAME.ToCountry
ToState widgets.MY_WIDGET_NAME.ToState
ToZip widgets.MY_WIDGET_NAME.ToZip
Confidence widgets.MY_WIDGET_NAME.Confidence
Digits widgets.MY_WIDGET_NAME.Digits
Speech Result widgets.MY_WIDGET_NAME.SpeechResult
Unstable Speech Result widgets.MY_WIDGET_NAME.UnstableSpeechResult

⚙ Run Function

Run function widget

説明:

Run Functionを使用すると、Twilio Function(クラウド上で実行される軽量でサーバーレスなコード)を実行できます。 このWidgetを使用してStudioのWidgetと協調動作するビジネスロジックを記述してアプリケーションを仕上げます。

Functionを呼び出す際の変数の使用にあたっては、下記の2つの選択肢があります: (!) Flowの変数をパラメーターとしてFunctionに渡す(例: flow.data.foo)ことができます。 そして (2) Functionから返されるデータ(TwiMLまたはJSONを返すことができます)をFlow変数に設定できます。

Note: For unique use cases, the Run Function widget can return custom TwiML to enhance your Studio Flow.

必須の構成

Function Widgetで唯一必須の構成は、呼び出したいFunctionのURLのみです。 ドロップダウンから選択するか、Functionを名前で検索できます。

名前

概要

初期値

Function URL

呼び出したいFunctionです。

Hello SMS

なし

オプションの構成

Function Widgetにはオプションの構成がいくつかあります:

名前

概要

初期値

Function Parameters

key/valueの組みとして表現される、Functionに渡される0個以上の追加パラメーターです。 文字列定数と変数がサポートされます。

なし

Transitions:

このWidgetにはTransitionをトリガーする2つのイベントがあります。

名前

概要

success

Functionの返りに成功した場合 (HTTP 20X)

Fail

FUnctionの返りに失敗した場合 (またはエラーがありました)

レスポンス:

The HTTP response from the Function must return a 2xx status code within 5 seconds, and the response body must not exceed 64kB.

レスポンス Recommendation 注釈
Status Code 200 or 204 3xx redirection is supported. 4xx or 5xx status code will transition to "failed" in the widget.
ContentType application/json Content-Type header is not required if Status Code is 204 No Content. Other content types are supported, such as plain text or XML. But only application/json objects (e.g. {"foo":"bar"}) will be automatically parsed into Studio variables.
Body valid JSON Body content must match the Content-Type header.
Response Time 5 seconds or less Studio will timeout the request at 5 seconds and transition to "failed" in the widget.
Response Size Maximum 64kb Studio can only process responses up to 64kB.


変数:

Twiml: If your function returns Twiml, the twiml will be returned to the calling client.

Json: FunctionがJsonを返す場合、widgets.MY_WIDGET_NAME.parsed経由でアクセスできます。

たとえば{"message": "Hi", "person": {"name": "Bob", "age": 40}}を返すと、後続のWidget内で下記のように参照できます:

widgets.MY_WIDGET_NAME.parsed.message

widgets.MY_WIDGET_NAME.parsed.person.name

widgets.MY_WIDGET_NAME.parsed.person.age

すべての返り値の型については下記の変数があります:

widgets.MY_WIDGET_NAME.body

widgets.MY_WIDGET_NAME.status_code

widgets.MY_WIDGET_NAME.content_type

⚙ Make Outgoing Call

The Make Outgoing Call widget has been upgraded and now supports enhanced call recording options and Answering Machine Detection. Any existing Flows using v1 will continue to work as before and show the old functionality of the widget. But for any new instances of the widget added to a Flow, only v2 of the widget will be available. For Flows that still rely on v1, refer to Make Outgoing Call v1 documentation.

Make Outgoing Call.png

説明:

Make Outgoing Call allows you to dial the Contact's phone number within your Flow. Use this Widget to reach the Contact with an automated call, and follow up by adding voice messages, asking for input via Gather. It can connect the Contact to an agent by dialing and merging with current call.

必須の構成:

The required fields for this Widget are To and From. The To must be the Contact's phone number and cannot be changed, but the From can be variables or hard-coded phone numbers.

名前

概要

初期値

Number To Call

Contactの電話番号 (変更できません)

Flow Default contact.channel.address

Number to Make Call From

発信者番号として使用する電話番号です

Flow Default flow.channel.address

オプションの構成:

名前

概要

初期値

Record Call

Record the call and save as an mp3.

Values: On, Off

If set to On, Recording Channels and Recording Status Callback URL fields can be set.

Off

RecordingChannels

The number of channels in the output recording.

Values : Mono Channel, Dual Channel

Mono Channel - Records all audio of the call in one channel.
Dual Channel - Records both parites of the call into separate channels.

Mono Channel

Recording Status Callback URL

The URL that will be called when the recording is available to be accessed.

なし

Trim Silence

Trim the leading and trailing silence from the call recording.

Values: On (trim-silence), Off (do-not-trim)

On

Detect Answering Machine

Detect if a human, answering machine, or fax has picked up the call

Values: On, Off

If set to On, other machine detection settings can be configured.

Off

マシン検出

The mode of Answering Machine Detection to run.

Values:

Detect Machine Start - Detect Machine Start will return a result as soon as the called party is identified. The ‘AnsweredBy’ Studio variable will be one of the following: machine_start, human, fax, unknown

Detect Machine End - Detect Machine End will return a human or fax immediately but when an answering machine is detected, it returns only at the end of the greeting, usually indicated by a beep. The ‘AnsweredBy’ studio variable will be one of the following:

machine_end_beep, machine_end_silence, machine_end_other, human, fax, unknown

Use Split widget to specify conditions based on values above.

Liquid Variable Input

See the Programmable Voice - Answering Machine Detection REST API docs for more information.

Detect Machine Start

Machine Detection Timeout (s)

The number of seconds that Twilio should attempt to perform Answering Machine Detection before timing out and returning the 'AnsweredBy' studio variable as unknown. (Only applicable if 'Detect Answering Machine' is set to 'On'.)

Possible values in seconds: 3s-120s

30s

Machine Detection Speech Threshold (ms)

The number of milliseconds that is used as the measuring stick for the length of the speech activity, where durations lower than this value will be interpreted as a human and longer than this value as a machine. (Only applicable if 'Detect Answering Machine' is set to 'On'.)

Possible values in milliseconds: 1000ms - 6000ms

2400ms

Machine Detection Speech End Threshold (ms)

The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. (Only applicable if 'Detect Answering Machine' is set to 'On'.)

Possible values in milliseconds: 500ms - 5000ms

1200ms

Machine Detection Silence Timeout (ms)

The number of milliseconds of initial silence after which an ‘unknown’ AnsweredBy result will be returned. (Only applicable if 'Detect Answering Machine' is set to 'On'.)

Possible values in milliseconds: 2000ms - 10000ms

5000ms

SendDigits

番号に接続した後にダイヤルするキーの文字列です。

なし

Timeout

The number of seconds the phone is allowed to ring before assuming there is no answer.

Possible values in seconds: 0s - 600s

60s

SipUsername

The username used to authenticate the caller making a SIP call.

なし

sip password

The password required to authenticate the user account specified in sip_auth_username.

なし

Transitions:

These are the events that trigger transitions from this widget:

名前

Key

概要

Answered

answered

Fired when a call is answered. If 'Detect Answering Machine' is 'On', the following additional parameter will be available in the Studio context as a variable:

  • AnsweredBy

例:

{{widgets.call_1.AnsweredBy}}


Inspect AnsweredBy in a Split widget to branch Flows. Possible values of AnsweredBy differ depending on what value the 'Machine Detection' parameter is set to. Refer to Answering Machine Detection documentation for full details.

BUSY

busy

Fired when the call is busy

No Answer

返答なし

Fired when the call is unanswered

Call Failed

failed

Fired when the call fails to initiate

⚙ Connect Call To

Connect Call To Widget

説明:

Connect Call To allows you to bridge an in-progress call with another phone number (or numbers), Client user, SIM, SIP endpoint, or conference. Use this widget to connect your customer with a different department, or if they’re looking to reach a specific operator.

必須の構成:

The required fields for this Widget are Connect Call To and Caller ID, which can be variables or hard-coded entries. Select the Connect Call To type from the dropdown in the Inspector Panel, then set the field value to the number(s)/address that most accurately reflects the intended recipient.

名前

概要

初期値

Connect Call To

The phone number(s), Client user, SIM, SIP endpoint, or conference to call.
Note: For Multiple Numbers, separate each with commas: +14157234000, +14155551212, +14158675310

callerId

発信者番号として使用する電話番号です

Flow Default contact.channel.address

オプションの構成:

名前

概要

初期値

Record

通話を録音し、mp3ファイルとして保存します

値: true、false

false



⚙ HTTP Request

HTTP Request Widget

説明:

HTTP Requestを使用すると、Studio外部のアプリケーションおよびコードとやり取りできます。 このWidgetを使用してFlowやFunctionsで定義されていないビジネスロジックの部分とやり取りします。

Note: Returning custom TwiML from an HTTP Request widget isn't supported. Use the Run Function widget instead, and follow our guide for returning custom TwiML from Twilio Functions.

必須の構成:

このWidgetに必須のフィールドはRequest MethodおよびRequest URLです。 Request Methodはドロップダウンから選択でき、URLはAutomaticに設定することができます。

名前

概要

RequestMethod

The desired HTTP method of your request (GET or POST)

Request URL

リクエストの送信先のURLです。

ヒント: URLのセキュリティーを向上させるには、Basic認証のクレデンシャルを追加します。 例: https://user:password@mydomain.com/handler.php

ContentType Content type of the request body, either application/x-www-form-urlencoded or application/json.

オプションの構成:

You may optionally decide to declare a request body and HTTP parameters for this Widget.

名前

概要

Request Body

Text to include as the body of your request.

HTTP Parameters

リクエストと一緒に渡す、パラメーターのひとつ以上のkey-valueの組です。 文字列定数と変数がサポートされます。


Transitions:

このWidgetにはTransitionをトリガーする2つのイベントがあります。

名前

概要

success

Functionの返りに成功した場合 (HTTP 20X)

Fail

The URL does not successfully return (or has an error)

レスポンス:

The HTTP response from the URL must return a 2xx status code within 5 seconds, and the response body must not exceed 64kB.

レスポンス Recommendation 注釈
Status Code 200 or 204 3xx redirection is supported. 4xx or 5xx status code will transition to "failed" in the widget.
ContentType application/json Content-Type header is not required if Status Code is 204 No Content. Other content types are supported, such as plain text or XML. But only application/json objects (e.g. {"foo":"bar"}) will be automatically parsed into Studio variables.
Body valid JSON Body content must match the Content-Type header.
Response Time 5 seconds or less Studio will timeout the request at 5 seconds and transition to "failed" in the widget.
Response Size Maximum 64kb Studio can only process responses up to 64kB.


変数:

Json: FunctionがJsonを返す場合、widgets.MY_WIDGET_NAME.parsed経由でアクセスできます。

たとえば{"message": "Hi", "person": {"name": "Bob", "age": 40}}を返すと、後続のWidget内で下記のように参照できます:

widgets.MY_WIDGET_NAME.parsed.message

widgets.MY_WIDGET_NAME.parsed.person.name

widgets.MY_WIDGET_NAME.parsed.person.age

すべての返り値の型については下記の変数があります:

widgets.MY_WIDGET_NAME.body

widgets.MY_WIDGET_NAME.status_code

widgets.MY_WIDGET_NAME.content_type

⚙ Record Voicemail

Record VM widget

説明:

Record Voicemail allows you to record the audio of a call and optionally transcribe it. Use this widget to save your conversation with customers. You can play back the audio file by referencing its URL in a Play widget using widgets.MY_WIDGET_NAME.RecordingUrl.

Note that Studio does not handle transcription processing automatically. You can specify the callback URL when transcription is complete and handle it yourself. Using a Function is a great way to customize the behavior, such as emailing the transcription, although it requires writing some code.

変数:

Sid widgets.MY_WIDGET_NAME.Sid
作成日 widgets.MY_WIDGET_NAME.DateCreated
更新日 widgets.MY_WIDGET_NAME.DateUpdated
Account SID widgets.MY_WIDGET_NAME.AccountSid
Call SID widgets.MY_WIDGET_NAME.CallSid
RecordingUrl widgets.MY_WIDGET_NAME.RecordingUrl
Duration widgets.MY_WIDGET_NAME.Duration
Price widgets.MY_WIDGET_NAME.Price
PriceUnit widgets.MY_WIDGET_NAME.PriceUnit
ApiVersion widgets.MY_WIDGET_NAME.ApiVersion
URI widgets.MY_WIDGET_NAME.Uri
Status widgets.MY_WIDGET_NAME.Status
ソース widgets.MY_WIDGET_NAME.Source
Channels widgets.MY_WIDGET_NAME.Channels

⚙ Enqueue Call

Enqueue Call Widget

説明:

Enqueue Call enqueues the current call into a call queue. The caller will hear hold music until the call is dequeued by another caller.

必須の構成:

You must select a Queue or TaskRouter Task when configuring this Widget. The choice may be selected from a dropdown, with additional configuration fields appearing based on the selection.

名前

概要

Queue Name

The name of the Queue to place the call into (i.e. "Everyone"). If this Queue doesn’t exist, it will be created on demand. Max length of 64 characters.

WorkflowSid

The desired Workflow ID for handling the TaskRouter Task.

オプションの構成:

You may optionally decide to declare task attributes, priority, timeout, and a hold music TwiML URL for the request initiated by this Widget.

名前

概要

Taskの属性

JSON representing task attributes (max 1024 characters)

Priority

The priority of this task in the TaskQueue. Tasks with a higher priority are assigned before older tasks with a lower priority. If not specified, will be treated as 0 during evaluation.

Timeout

The number of seconds you want the task to remain in this TaskQueue. Must be a positive integer < 2 weeks in seconds. If not specified, defaults to infinity.

Hold Music TwiML URL

The URL for custom hold music TwiML. If not specified, the default hold music will play upon enqueue.

Transitions:

名前

概要

Call Complete

Transition is triggered when the Enqueue action URL is requested. Due to the underlying behavior of the Enqueue action URL, Studio can only regain control of the live call after dequeueing if the call was originally dequeued using <Dial><Queue>.

Failed to Enqueue

Transition is triggered if enqueuing of the call fails, such as if the queue is full (max 100 members).

Call Failed

Transition is triggered if QueueResult is "system-error".

⚙ Autopilot

Autopilot Studio Wdiget

説明:

Send calls or messages to Autopilot's intelligent assistant platform. Autopilot allows you to build conversational IVRs and chatbots using natural language understanding and conversational flows for voice calls, SMS, and messaging apps like Whatsapp, Google Assistant, and FB Messenger.

必須の構成:

You must select an Autopilot Assistant when configuring this Widget.

名前

概要

Assistant Unique Name

The Autopilot's Assistant unique name

Messaging and Chat Configuration:

You need to specify the following configuration when using the Autopilot widget with SMS Messaging or Chat.

名前

概要

初期値

Send Message From


The Bot's name that the end user sees on the Chat.

Programmable Chat Service

The Programmable Chat Service Sid where the chat is deployed.

{{trigger.message.InstanceSid}}

Message Attributes

The Programmable Chat Channel where the messages are sent and where the bot should reply.

{{trigger.message.ChannelSid}}

Body

The message to be sent to Autopilot for natural language understanding.

{{trigger.Message.Body}}

Transitions:

名前

概要

Session Ended

When Autopilot Session ends either by doing a handoff or the absence of a listen.

error


When a system error occurs

⚙ Send to Flex

Send to Flex widget

説明:

For Flex-enabled Projects, Send to Flex transfers a call or a message to Flex by creating a TaskRouter Task. Voice calls are enqueued and the caller will hear hold music while waiting for a Worker. Messages are transferred to Flex as new tasks for assignment to a Worker.

必須の構成:

You must select a Workflow and Channel when configuring this Widget.

名前

概要

Workflow

The name of the Flex Worfklow assigned to the Project.

Channel

The Task Channel being used. Only Voice and Chat are currently supported (select Chat for SMS).

オプションの構成:

You may optionally decide to declare task attributes, priority, timeout, and a hold music TwiML URL for the request initiated by this Widget. These

名前

概要

Priority

The priority of this task in the TaskQueue. Tasks with a higher priority are assigned before older tasks with a lower priority. If not specified, will be treated as 0 during evaluation.

Timeout

The amount of time in seconds the task is allowed to live up to a maximum of 2 weeks. Defaults to 24 hours if not supplied.

属性

JSON representing task attributes (max 1024 characters)

URL Method

Method to be used when requesting the Hold Music TwiML URL (GET or POST)

Hold Music TwiML URL

The URL for custom hold music TwiML. If not specified, the default hold music will play upon transfer.

Transitions:

名前

概要

Task Created

For Voice calls, transition is triggered when the Enqueue action URL is requested. For Messages, transition is triggered as soon as the TaskRouter Task is created.

Failed to Create Task

For Voice calls, transition is triggered if enqueuing of the call fails. For Messages, transition is triggered immediately when TaskRouter returns an error for Task creation.

Call Failed

Only applies to Voice calls. Transition is triggered if QueueResult is "system-error".

⚙ Capture Payments

Capture Payments widget

説明:

Capture Payments allows you to securely capture credit card details on a call and either tokenize or process the payment using a Payment Gateway. This widget uses the underlying TwiML verb <Pay>.

Note: Use of Capture Payments requires PCI Mode to be enabled in Voice Settings.

オプションの構成:

名前

概要

Timeout

Sets the limit in seconds to wait for the caller to press another digit before moving on to validate the digits captured.

Max Attempts

Number of times to retry when collecting information.

Language

Language to speak when prompting the caller for credit card details.

Valid Card Types

Credit card types that should be accepted. Allows multiple values.

Request Security Code

Whether to prompt for credit card security code.

Request Postal Code

Whether to prompt for postal code.

Pay Connector

Unique Name corresponding to the Payment Gateway Connector installed in Twilio Add-ons

Payment Token Type

Select one-time payment or reusable payment.

Charge Card with Amount

Amount to be charged.

Currency

Currency to use when charging the card.

概要

Description of the payment.

Transitions:

名前

概要

success

Payment has completed successfully.

Max Failed Attempts

Maximum number of failed attempts has been reached.

Provider Error

Error communicating with Payment Provider.

Pay Interrupted

Payment process interrupted by caller pressing *.

通話を終了する

Caller hung up during payment process.

Validation Error

Invalid attributes received.

⚙ Set Variables

Set Variables Widget

説明:

Set Variables allows you to save key/value pairs in the global context of the flow execution. Variables set via the widget are accessible throughout your flow via other widgets under the key {{flow.variables.<key>}}. This allows you to enable use cases such as counters that are dynamically updated as your flow executes.

オプションの構成:

You can add any number of Variables. Variables can have static values like a single number or string, or dynamic values set via the Liquid templating language.

Example that sets a variable called count to 0 if not set and increments it if it exists:

{% if flow.variables.count %}
  {{flow.variables.count | plus: 1}}
{% else %}
  0
{% endif %}

Configuration

名前

概要

Key

The name of this variable, once set, will be accessible in liquid via {{flow.variables.<key>}}.

Note: Variable names are case sensitive. Foo is a different variable to foo.

The variable value to set. This can be a number or string value, or a liquid template block like the example above.

Transitions

There is only one transition from this widget, "Next" which fires once any variables specified are set.

Example Flow

In the call flow screenshot below, the count variable is set to 0 when the flow starts, and the flow will loop until the count variable is equal to 3 and then exit (The set variable widget uses the sample liquid template code from above).

Screen Shot 2018-12-11 at 10.11.23 AM.png

⚙ Fork Stream

Fork Stream Studio Widget

説明:

Fork Stream allows you to send real-time audio streams of a phone call over the Internet. Websocket and SIPREC protocols are supported.

必須の構成:

You must select an Action when configuring this Widget.

名前

概要

Action

Whether you want to Start or Stop a stream.

オプションの構成:

名前

概要

Stream Name

Friendly name given to the Stream

Stream Type

Transport protocol, one of WebSocket or SIPREC.

URL

URL of the service where to stream the audio. This is requrired when the Stream Type is WebSocket. The only supported protocol is wss.

Connector Name

Name of the Add-on use to configure the Stream. This is required when Stream Type is SIPREC.

Tracks

Select audio streams to be sent. Can be any of: Inbound Track, Outbound Track or Both Tracks

Stream Parameters

Zero or more extra parameters expressed as key/value pairs that will be sent to the remote service during connection.

Transitions

The "Next" transition fires inmediately after the Stream connection has been created (Start) or terminated (Stop).

Example Flow

In the call flow screenshot below the audio streams of an incoming call are forked for real-time processing while the call is bridged to another phone number.

Fork Stream Studio Flow

⚙ Call Recording

通話録音

説明:

Call Recording allows you to switch Voice Call Recording ON or OFF at any point during a call flow.

Warning!

The Call recording widget cannot be placed as the first widget - it must come after another widget like an initial Say/Play or Gather. It is important to consider whether your use case requires that your customers be warned before a call is recorded.

必須の構成:

You must choose whether the Recording is to be switched on or off.

名前

概要

初期値

RECORD CALL

A toggle button (boolean) to allow users to Toggle Call Recording to On or Off within a Call Flow

  1. 録音の開始
  2. Stop Recording

Please note that these options are not for pausing and resuming a Voice Recording, they are specifcally meant for Start and Stop.

Please do read Legal Considerations with Recording Voice and Video Communications

false

オプションの構成:

You may optionally decide to declare recording Status Call back Url, Recording Channels, trim behaviour and a for the request initiated by this Widget.

Name/Key

概要

初期値

RECORDING STATUS CALLBACK URL

The URL we should call using the recording_status_callback_method on each recording event specified inrecording_status_callback_event. For more information, see RecordingStatusCallback parameters.

empty

RECORDING STATUS CALLBACK METHOD

The HTTP method we should use to call recording_status_callback. Can be: GET or POST. The default is POST.

POST

RECORDING STATUS EVENT

The recording status events on which we should call the recording_status_callback URL. Can be: in-progress, completed and absent. Default is completed. Separate multiple event values with space.

completed

RECORDING CHANNELS

The number of channels used in the recording. Can be: mono or dual and the default is dual. mono records all parties of the call into one channel. dual records each party of a 2-party call into separate channels.

TRIM

Whether to trim any leading and trailing silence in the recording. Can be: trim-silence or do-not-trim and the default is do-not-trim. trim-silence trims the silence from the beginning and end of the recording and do-not-trim does not.

do-not-trim



Transitions:

These are the events that trigger transitions from this widget:

名前

Key

概要

success

success

The call recording was successfully toggled

失敗

failed

Could not toggle call recording

変数:

The following variables will be added to the Execution context (where MY_WIDGET_NAMEis the name of your actual widget):

Status

widgets.MY_WIDGET_NAME.status

Conference SID

widgets.MY_WIDGET_NAME.conference_sid

PriceUnit

widgets.MY_WIDGET_NAME.price_unit

更新日

widgets.MY_WIDGET_NAME.date_updated

開始時刻

widgets.MY_WIDGET_NAME.start_time

Recording Uri

widgets.MY_WIDGET_NAME.uri

Account SID

widgets.MY_WIDGET_NAME.account_sid

Channels

widgets.MY_WIDGET_NAME.channels

Source of Recoring Start

widgets.MY_WIDGET_NAME.source

Encryption Details

widgets.MY_WIDGET_NAME.encryption_details

Call SID

widgets.MY_WIDGET_NAME.call_sid

レコーディングSID

widgets.MY_WIDGET_NAME.sid

Duration

widgets.MY_WIDGET_NAME.duration

作成日

widgets.MY_WIDGET_NAME.date_created

エラー コード

widgets.MY_WIDGET_NAME.error_code

Price

widgets.MY_WIDGET_NAME.price

ApiVersion

widgets.MY_WIDGET_NAME.api_version

⚙ TwiML Redirect

TwiML Redirect Widget.png

説明:

TwiML Redirect allows you to redirect a call or message to be handled outside of Studio.

Returning control to Studio

To handle returning control to Studio, you need to specify a <Redirect> to the Studio Webhook URL and append ?FlowEvent=return. Any additional parameters specified in the return URL will be injected into the Studio context and addressable via Liquid template variables.

例:

<Response>
  <Say>Returning you back to the Studio Flow.</Say>
  <Redirect>https://webhooks.twilio.com/v1/...?FlowEvent=return&foo=bar</Redirect>
</Response>

The URL parameter foo illustrated above will be passed automatically into your Flow and can be referenced via Liquid as {{widgets.your_redirect_widget_name.foo}}.

Tip: To retrieve the Studio Webhook URL, in your Studio flow, click the red Trigger widget. The URL starting with https://webhooks.twilio.com/v1/... is the Webhook URL.

必須の構成:

名前

概要

初期値

URL

URL where the call or message will be redirected.

なし

オプションの構成:

名前

概要

初期値

Method

HTTP method to be used in the redirect

POST

Timeout

Number of seconds to wait for control to be returned to Studio. Set to 0 if returning control is not desired.

Possible values in seconds: 0 to 14400 seconds (4 hours)

14400

Transitions:

These are the events that trigger transitions from this widget:

名前

Key

概要

Return

return

Fired when the next TwiML fetch is received from Voice or Messaging for the current Execution

Timeout

Timeout

Fired when the timer is expired, and no new TwiML fetch is received for the current Execution

失敗

failed

Fired when the URL is not successfully returned (or has an error)

Rate this page:

ヘルプが必要ですか?

誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。