Programmable Chat REST API
Programmable Chat will no longer be available or supported after July 25, 2022. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here.
If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.
The Programmable Chat REST API allows you to control your Chat applications from the server in much the same way you can from the client, except from a service perspective rather than a 1st person one. You can create channels, send messages, and query the state of your messaging applications using the resources in this REST API.
APIのベースURL
リファレンスドキュメントの URL はすべて、次のベース URL を使用しています。
https://chat.twilio.com/v2
All requests to the Programmable Chat REST API are served over HTTPS. Unencrypted HTTP is not supported.
認証
REST API への HTTP リクエストは、Twilio で提供される他の REST API と同様、HTTP ベーシック認証により保護されます。Twilio がどのように認証を処理するかは、セキュリティードキュメントをご確認ください。簡単に言うと、HTTP ベーシック認証では Twilio AccountSID をユーザー名、AuthToken をパスワードとして使います。
curl -G https://chat.twilio.com/v2/Services \
-u '[YOUR ACCOUNT SID]:[YOUR AUTH TOKEN]'
アカウント Sid と Auth Token はアドミンコンソールで確認できます。別の方法として、API キーと API シークレットを使用して、REST API リクエストを認証することもできます。API キーのペアもコンソールで管理できます。
Twilio ヘルパーライブラリ
You can use the Twilio Helper Libraries to interact with the Programmable Chat REST endpoints.
Programmable ChatはTwilioヘルパーライブラリーの次世代リリースで利用可能です。
リソース
REST API を使って操作するリソースは以下のとおりです。
リソース | 概要 |
---|---|
Binding | A push notification subscription for Users within the Service instance |
Channel | A "chat room" - a container having members, in which messages can be exchanged. |
Credential | Twilio が Google Cloud Messaging または Apple Push Notifications Service と統合する際に使用するクレデンシャルです。 |
Invite | Invitations to a Channel |
メンバー | チャンネルのメンバーです。 |
Message | チャンネルに送信されるメッセージです。 |
ロール | チャンネルスコープまたはサービススコープでユーザーに実行を許可するアクションを定義します。 |
Service (サービス) | A service roughly maps to a Chat app. Channels, Users, Credentials, and all the REST (see what I did there?) are scoped to a Service. Can define webhook URLs for events in a Service |
ユーザー | サービススコープ内でユニークなアイデンティティを持つユーザーです。 |
Media Messaging
Programmable Chat Multimedia Messaging feature has a REST API available via stand-alone API endpoint. Please refer to the Media Resource documentation for more details.
ヘルプが必要ですか?
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.