Skip to contentSkip to navigationSkip to topbar
On this page

Chat Channel Migration Resource


A Channel is a Programmable Chat object that is equivalent to a Conversation in the Conversations API.

Please see the Conversation Resource for Conversations that are already available to your Conversations application.

Only 'private' type Channels are automatically migrated to Conversations. For 'public' type Channels, please use this API to migrate them to 'private' type.


API Base URL

api-base-url page anchor
1
https://chat.twilio.com/v3
2

There is only one API endpoint on the v3 Chat API:

1
POST /Services/ISxx/Channels/CHxx
2

Property nameTypeRequiredDescriptionChild properties
sidSID<CH>Optional
Not PII

The unique string that we created to identify the Channel resource.

Pattern: ^CH[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>Optional

The SID of the Account that created the Channel resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

service_sidSID<IS>Optional

The SID of the Service the Channel resource is associated with.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34

friendly_namestringOptional
PII MTL: 30 days

The string that you assigned to describe the resource.


unique_namestringOptional

An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's sid in the URL.


attributesstringOptional

The JSON string that stores application-specific data. If attributes have not been set, {} is returned.


typeenum<string>Optional

The visibility of the channel. Can be: public or private.

Possible values:
publicprivate

date_updatedstring<date-time>Optional

The date and time in GMT when the resource was last updated specified in ISO 8601(link takes you to an external page) format.


created_bystringOptional

The identity of the User that created the channel. If the Channel was created by using the API, the value is system.


members_countintegerOptional

The number of Members in the Channel.

Default: 0

messages_countintegerOptional

The number of Messages that have been passed in the Channel.

Default: 0

messaging_service_sidSID<MG>Optional

The unique ID of the Messaging Service this channel belongs to.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34

urlstring<uri>Optional

The absolute URL of the Channel resource.


POST https://chat.twilio.com/v3/Services/{ServiceSid}/Channels/{Sid}

Use this API to change a Channel's type from public to private. This makes it available in Conversations.

(information)

Info

Read here to determine if you need to include a Messaging Service SID in your request.

Headers

headers page anchor
Property nameTypeRequiredPIIDescription
X-Twilio-Webhook-Enabledenum<string>Optional

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse
Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

The unique SID identifier of the Service.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34

Sidstringrequired

A 34 character string that uniquely identifies this Channel.

Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
Typeenum<string>Optional

TThe Type for this Channel to migrate to. Can only be private. Migration to 'public' is not allowed.

Possible values:
publicprivate

MessagingServiceSidSID<MG>Optional

The unique ID of the Messaging Service this channel belongs to.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34
Migrate public Channel to ConversationsLink to code sample: Migrate public Channel to Conversations
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateChannel() {
11
const channel = await client.chat.v3
12
.channels("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "Sid")
13
.update({
14
messagingServiceSid: "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
15
type: "private",
16
});
17
18
console.log(channel.sid);
19
}
20
21
updateChannel();

Output

1
{
2
"sid": "Sid",
3
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
6
"friendly_name": "friendly_name",
7
"unique_name": "unique_name",
8
"attributes": "{ \"foo\": \"bar\" }",
9
"type": "private",
10
"date_created": "2015-12-16T22:18:37Z",
11
"date_updated": "2015-12-16T22:18:38Z",
12
"created_by": "username",
13
"members_count": 0,
14
"messages_count": 0,
15
"url": "https://chat.twilio.com/v3/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
16
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.