チャンネルリソース
Programmable ChatのChannelリソースは「チャットルーム」、すなわちMessageの送受信できる範囲を表しています。
Memberを追加したり、Channelへの参加を招待できます。 ChannelはChat Serviceスコープ内に存在します。
指定されたUserがMemberである全Channelを返すUsers Channelの一覧を取得できます。
チャンネルには、オプションで、アドレス可能なユニーク名を付けることもできます。これにより、チャンネルに何か具体的な名前を付けて、直接検索したり、識別したりできます。ユニーク名は、サービスインスタンス内でユニークであるように強制されます。
Twilio コンソール
You can view your Chat Channels using your Twilio console when logged in to the console. Within a Service, you will be able to browse the Channels within the Service.
プロパティ
各チャンネルに次のプロパティがあります。
Names in Node.js format | |
---|---|
sid
|
このリソースを一意に識別する 34 文字の文字列です。 |
accountSid
|
チャンネルに関連するアカウントのユニーク ID です。 |
serviceSid
|
このチャンネルが属するサービスのユニーク ID です。 |
friendlyName
|
このチャンネルの、人間が読みやすい形式の名前です。オプション。 |
uniqueName
|
このチャンネルの、ユニークでアドレス可能な名前です。オプション。 |
attributes
|
An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned. |
type
|
このチャンネルの適用範囲を |
dateCreated
|
このリソースの作成された日付です。 |
dateUpdated
|
このリソースが最後に更新された日付です。 |
createdBy
|
チャンネル作成者のアイデンティティ。API を使用して作成された場合の値: |
membersCount
|
Channel内のMember数です |
messagesCount
|
Channel内のMessage数です。 |
url
|
このチャンネルの絶対 URL です。 |
links
|
Members、Messages、Invites、および存在する場合はこのChannelの最後のMessageにアクセスする絶対URLです。 |
Names in Node.js format | |
---|---|
serviceSid
必須
|
Sid of the Service channel belongs to. |
type
オプション
|
このチャンネルの適用範囲を |
Names in Node.js format | |
---|---|
serviceSid
必須
|
Sid of the Service this channel belongs to. |
friendlyName
オプション
|
人間が読みやすい形式のチャンネルの名前です。オプション。 |
uniqueName
オプション
|
このチャンネルの、ユニークでアドレス可能な名前です。オプション。 |
attributes
オプション
|
An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned. |
type
オプション
|
このチャンネルの適用範囲を |
dateCreated
オプション
|
The optional ISO8601 time specifying the datetime the Channel should be set as being created. Will be set to the current time by the Chat service if not specified. Note that this should only be used in cases where a a Channel is being recreated from a backup/separate source |
dateUpdated
オプション
|
The optional ISO8601 time specifying the datetime the Channel should be set as having been last updated. Will be set to the |
createdBy
オプション
|
Optional field to specify the Identity of the User that created the Channel. Will be set to "system" if not specified. |
主なレスポンスコード
code | description |
---|---|
409 Conflict | 指定された一意な名前のChannelがすでに存在します。 |
チャンネルを取得する
ChannelはSIDまたはUniqueName(一意な名前)から取得できます
Channel SID
GET /Services/{Service SID}/Channels/{Channel SID}
UniqueName
GET /Services/{Service SID}/Channels/{Unique Name}
チャンネルを更新する
You are able to update a Channel via the SID or UniqueName
Channel SID
POST /Services/{Service SID}/Channels/{Channel SID}
UniqueName
POST /Services/{Service SID}/Channels/{Unique Name}
パラメーター
Names in Node.js format | |
---|---|
serviceSid
必須
|
Sid of the Service this channel belongs to. |
sid
必須
|
Key that uniquely defines the channel to fetch. Could be Sid or UniqueName |
friendlyName
オプション
|
人間が読みやすい形式のチャンネルの名前です。オプション。 |
uniqueName
オプション
|
このチャンネルの、ユニークでアドレス可能な名前です。オプション。 |
attributes
オプション
|
An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned. |
dateCreated
オプション
|
The optional ISO8601 time specifying the datetime the Channel should be set as being created. |
dateUpdated
オプション
|
The optional ISO8601 time specifying the datetime the Channel should be set as having been last updated. |
createdBy
オプション
|
Optional field to specify the Identity of the User that created the Channel. |
チャンネルを削除する
You are able to delete a Channel via the SID or UniqueName
Channel SID
DELETE /Services/{Service SID}/Channels/{Channel SID}
UniqueName
DELETE /Services/{Service SID}/Channels/{Unique Name}
ヘルプが必要ですか?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.