メニュー

Expand
ページを評価:

Twilio Channels

公開ベータ

Some Twilio Channels are currently available as a Public Beta product. This means that some features are not yet implemented and others may be changed before the product is declared as Generally Available.

公開ベータ製品は、Twilioでのサポート対象外となります。

Channels are the collection of third-party integrations that let you send and receive messages on multiple channels with the Twilio APIs you already use. Using Channels with Twilio makes it easy to reach your customers on new platforms, such as Facebook Messenger, WhatsApp, and more.

Channels are available through the Twilio Marketplace; you can choose from a list of verified Channels and install them in a single click. Once installed, they allow you to send and receive messages with other communications platforms using the Twilio API.

サポート対象製品

Twilio Channels are currently supported by Programmable Messaging and Notify. Click here to install specific Channels or request access to Channels in Developer Preview.

Channels in Public Beta:
Facebook Messenger

サービス利用規約

Channels are provided and supported by Channel providers in the Twilio Marketplace. As a part of the Channel installation process, you will be required to accept the Channel provider’s Terms of Service. Note that the Channel is provided under the Partner’s Terms of Service & Privacy policy. Channel-specific documentation can be found inside the Console under the Channel's catalog page.

Channelのセットアップと設定

Channelのインストール

Channelを始めるのは簡単です。利用可能なChannelは、管理画面のChannelカタログにリストされています。利用を始めるには、Channelをクリックしてインストールします。すると、1つのChannelインスタンスが作られ、固有の識別子を使って設定し、Twilio製品と連携できるようになります。

Using the WhatsApp API with Twilio

Twilio's support for the WhatsApp Business API is now Generally Available. To get started, see the API docs here.

Channelプロバイダの認証と設定

In order to send and receive messages from a Channel, you must have an account set up within the specified platform. You will then authorize Twilio to send and receive messages on your behalf, thereby enabling access to each platform through the Twilio API.

Once a Channel is enabled, the next step is to authenticate the Channel instance with the Channel provider. This also links the Channel instance to a Channel-specific endpoint (such as a Facebook page) within that Channel. The specifics of this vary from Channel to Channel; please refer to Channel-specific documentation on the Channel detail page inside the console.

Channelが認証されたら、Twilio APIから動かせるよう設定します。

設定パラメータ 概要
Channel address This is a unique identifier for the user facing Channel endpoint such as a Facebook Page. Channel addresses take the form of channel-provider:identifier. For instance, the Channel address for a Facebook Channel is messenger:<page id>. This can not be changed by the end user.
Callback URL メッセージが届くたびにTwilioがPOSTを投げる先のURL。Twilioが送ってくるリクエストの形式はSMS受信のTwiMLリクエストと同じです。絶対パスURLで指定する場合は、有効なホスト名が含まれていなければなりません(アンダーバーは利用不可)
Callback Method Callback URL を送るメソッドの指定。GET or POST.
Fallback URL Callback URLの先からエラーが返った場合に、TwilioがPOSTを送る先のURL。
Fallback Method Fallback URL を送るメソッドの指定。GET or POST.
Status Callback URL 送信したメッセージのステータスが failed または sent に変化したときにTwilioがPOSTを投げる先のURL。Twilio は、標準TwiMLリクエストパラメータと同様に、標準ステータスパラメータMessageStatusErrorCode もPOSTします。絶対パスURLで指定する場合は、有効なホスト名が含まれていなければなりません。(アンダーバーは利用不可)
StatusCallbackMethod Status Callback を送るメソッドの指定。GET or POST.

Channel で複数のインスタンスを作る

Twilio supports creating multiple instances of a Channel so that your application can use different Channel-specific endpoints. For example, this allows you to support sending/receiving messages from multiple Facebook pages, by creating and associating each Facebook page with an instance of the Facebook Channel.

Channel を利用する

Channel経由でメッセージを送受信するには、Twilio API製品群を利用できます。必要なのは、Channel をインストールしたときに設定した Channel address を参照することです。

Channel を設定したら、どのTwilio製品でChannelを使うか、各プロダクトの「Use In」チェックボックスを選択します。

Channel Addresses

Each Channel uses a different unique identifier scheme to address users. The table below lists how users are identified by each supported Channel when used with Twilio APIs. For more details on endpoints and addresses for a given Channel, please refer to Channel-specific documentation on the Documentation page linked to from the Channel detail page inside the console.

Channel エンドユーザーに見えるChannel endpoint Channel endpoint address Channel user address 注釈
Facebook Messenger Facebook Page messenger:{page-id} messenger:{messenger id} Messenger ID is different from a Facebook ID, and is specific between the Messenger User and your Facebook Page. It can only be retrieved when the Facebook Messenger User sends you a message.

The WhatsApp Business API with Twilio

See the table below for the addressing scheme for WhatsApp:

Channel エンドユーザーに見えるChannel endpoint Channel endpoint address Channel user address 注釈
WhatsApp Business phone number whatsapp:{e164 formatted phone number} whatsapp:{user's e164 formatted phone number} See here to get started with WhatsApp.

プログラマブル メッセージング

In order to use a Channel with Twilio's Programmable Messaging, you need to check the "Use In: Programmable SMS Inbound" checkbox.

メッセージの送信

See the REST API: Sending a SMS or MMS or REST API: Messages page for details on how to use Channels via Programmable Messaging APIs to send a message.

以下は、Programmable SMS を使ってFacebookメッセンジャーへメッセージを送信する例です:

curl -X "POST" \
--data-urlencode 'To=messenger:{Messenger User ID}' \
--data-urlencode 'From=messenger:{Facebook Page ID}' \
--data-urlencode 'Body=Would you like to play a game?' \
-u {Account Sid}:{Auth Token} \
https://api.twilio.com/2010-04-01/Accounts/{AccountSID}/Messages.json

メッセージの受信

In order to receive a message from a Channel that supports Programmable Messaging, set the Callback URL under Configuration section once the Channel has been installed. This URL will receive a callback with the same format as Incoming SMS TwiML Callbacks.

Managing Opt-Ins, Opt-Outs, and Consumer Preferences

SMSアプリケーションでユーザーのオプトインが課されるように、OTTプラットフォームでは自身のユーザーのオプトイン管理が必須となります。ご自身のアプリケーションのユーザーが、各Channel からメッセージによるコンタクトを行うことを明確に承諾できるような仕組みを用意しなければなりません。例えば、「テキストメッセージを送る行為」についてオプトインしていた場合でも、これが同時に「メッセンジャー経由でその人にコンタクトを取る行為」を許可したことにはなりません。

Similarly, you should respect consumers who opt-out on each platform. Each platform has its own method of opting out, which Twilio will normalize for you as much as possible. For example, consumers may text STOP to opt-out of SMS, or they may block your application to stop messaging within an OTT channel. If a user opts out of one communication channel, you are NOT required to opt them out of all channels. You may treat each opt-in and opt-out independently.

ページを評価:

ヘルプが必要ですか?

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

        
        
        

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

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

        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