Skip to contentSkip to navigationSkip to topbar
On this page

Messaging Service ChannelSender Resource


(warning)

Public Beta

The Service Resource is currently available as a Public Beta product. This means that some features for configuring your Messaging Service via the REST API are not yet implemented, and others may be changed before the product is declared Generally Available. Messaging Service Configuration through the Twilio Console(link takes you to an external page) is Generally Available.

Public Beta products are not covered by a Twilio SLA(link takes you to an external page).

The resources for sending Messages with a Messaging Service are Generally Available.

The ChannelSender subresource of a Service Resource represents a channel sender that is associated with a Messaging Service, such as WhatsApp.

When sending a message with your Messaging Service to a channel destination, Twilio will select a channel sender of that corresponding channel from the service for delivery.

See Twilio Channels: A New Way Reach Customers in Apps They Already Use(link takes you to an external page) for more information on Twilio Channels.


ChannelSender Properties

channelsender-properties page anchor
Property nameTypeRequiredDescriptionChild properties
account_sidSID<AC>Optional
Not PII

The SID of the Account that created the ChannelSender resource.

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

messaging_service_sidSID<MG>Optional

The SID of the Service the resource is associated with.

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

sidSID<XE>Optional

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

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

senderstringOptional

The unique string that identifies the sender e.g whatsapp:+123456XXXX.


sender_typestringOptional

A string value that identifies the sender type e.g WhatsApp, Messenger.


country_codestringOptional

date_createdstring<date-time>Optional

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


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.


urlstring<uri>Optional

The absolute URL of the ChannelSender resource.


Create a ChannelSender resource (Add a Channel Sender to a Messaging Service)

create-a-channelsender-resource-add-a-channel-sender-to-a-messaging-service page anchor
POST https://messaging.twilio.com/v1/Services/{MessagingServiceSid}/ChannelSenders

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
MessagingServiceSidSID<MG>required

The SID of the Service to create the resource under.

Pattern: ^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
SidSID<XE>required

The SID of the Channel Sender being added to the Service.

Pattern: ^XE[0-9a-fA-F]{32}$Min length: 34Max length: 34
Add a Channel Sender to a Messaging ServiceLink to code sample: Add a Channel Sender to a Messaging Service
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 createChannelSender() {
11
const channelSender = await client.messaging.v1
12
.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.channelSenders.create({ sid: "XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" });
14
15
console.log(channelSender.accountSid);
16
}
17
18
createChannelSender();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"sid": "XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"sender": "whatsapp:+12487960483",
6
"sender_type": "WhatsApp",
7
"country_code": "US",
8
"date_created": "2023-07-30T20:12:31Z",
9
"date_updated": "2023-07-30T20:12:33Z",
10
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders/XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
11
}

Fetch a ChannelSender resource

fetch-a-channelsender-resource page anchor
GET https://messaging.twilio.com/v1/Services/{MessagingServiceSid}/ChannelSenders/{Sid}

Property nameTypeRequiredPIIDescription
MessagingServiceSidSID<MG>required

The SID of the Service to fetch the resource from.

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

Sidstringrequired

The SID of the ChannelSender resource to fetch.

Fetch a Channel Sender from a Messaging ServiceLink to code sample: Fetch a Channel Sender from a Messaging Service
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 fetchChannelSender() {
11
const channelSender = await client.messaging.v1
12
.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.channelSenders("XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.fetch();
15
16
console.log(channelSender.accountSid);
17
}
18
19
fetchChannelSender();

Output

1
{
2
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
4
"sid": "XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"sender": "whatsapp:+12487960483",
6
"sender_type": "WhatsApp",
7
"country_code": "US",
8
"date_created": "2023-07-30T20:12:31Z",
9
"date_updated": "2023-07-30T20:12:33Z",
10
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders/XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
11
}

Read multiple ChannelSender resources

read-multiple-channelsender-resources page anchor
GET https://messaging.twilio.com/v1/Services/{MessagingServiceSid}/ChannelSenders

Property nameTypeRequiredPIIDescription
MessagingServiceSidSID<MG>required

The SID of the Service to read the resources from.

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

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

Read Channel Senders of a Messaging ServiceLink to code sample: Read Channel Senders of a Messaging Service
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 listChannelSender() {
11
const channelSenders = await client.messaging.v1
12
.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.channelSenders.list({ limit: 20 });
14
15
channelSenders.forEach((c) => console.log(c.accountSid));
16
}
17
18
listChannelSender();

Output

1
{
2
"meta": {
3
"page": 0,
4
"page_size": 20,
5
"first_page_url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders?PageSize=20&Page=0",
6
"previous_page_url": null,
7
"next_page_url": null,
8
"key": "senders",
9
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders?PageSize=20&Page=0"
10
},
11
"senders": [
12
{
13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
15
"sid": "XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
16
"sender": "whatsapp:+12487960483",
17
"sender_type": "WhatsApp",
18
"country_code": "US",
19
"date_created": "2023-07-30T20:12:31Z",
20
"date_updated": "2023-07-30T20:12:33Z",
21
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders/XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
22
},
23
{
24
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
25
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
26
"sid": "XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab",
27
"sender": "messenger:104794531907950",
28
"sender_type": "Messenger",
29
"country_code": "US",
30
"date_created": "2023-07-30T20:12:31Z",
31
"date_updated": "2023-07-30T20:12:33Z",
32
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders/XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"
33
},
34
{
35
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
36
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
37
"sid": "XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac",
38
"sender": "rcs:ms_dev_ttatqler_agent",
39
"sender_type": "RCS",
40
"country_code": "US",
41
"date_created": "2023-07-30T20:12:31Z",
42
"date_updated": "2023-07-30T20:12:33Z",
43
"url": "https://messaging.twilio.com/v1/Services/MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelSenders/XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac"
44
}
45
]
46
}

Delete a ChannelSender resource

delete-a-channelsender-resource page anchor
DELETE https://messaging.twilio.com/v1/Services/{MessagingServiceSid}/ChannelSenders/{Sid}

Returns "204 NO CONTENT" if the channel sender was successfully removed from the Service.

Property nameTypeRequiredPIIDescription
MessagingServiceSidSID<MG>required

The SID of the Service to delete the resource from.

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

Sidstringrequired

The SID of the Channel Sender resource to delete.

Remove a Channel Sender from a Messaging ServiceLink to code sample: Remove a Channel Sender from a Messaging Service
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 deleteChannelSender() {
11
await client.messaging.v1
12
.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.channelSenders("XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.remove();
15
}
16
17
deleteChannelSender();

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.