ChannelSenders subresource
Public Beta
The Services 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 is Generally Available.
Public Beta products are not covered by a Twilio SLA.
The resources for sending Messages with a Messaging Service are Generally Available.
ChannelSenders is subresource of Services and 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 for more information on Twilio Channels.
The SID of the Account that created the ChannelSender resource.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Service the resource is associated with.
^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34The unique string that we created to identify the ChannelSender resource.
^XE[0-9a-fA-F]{32}$Min length: 34Max length: 34A string value that identifies the sender type e.g WhatsApp, Messenger.
The date and time in GMT when the resource was created specified in ISO 8601 format.
The date and time in GMT when the resource was last updated specified in ISO 8601 format.
The absolute URL of the ChannelSender resource.
POST https://messaging.twilio.com/v1/Services/{MessagingServiceSid}/ChannelSenders
application/x-www-form-urlencodedThe SID of the Channel Sender being added to the Service.
^XE[0-9a-fA-F]{32}$Min length: 34Max length: 341// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID at twilio.com/console5// Provision API Keys at twilio.com/console/runtime/api-keys6// and set the environment variables. See http://twil.io/secure7// For local testing, you can use your Account SID and Auth token8const accountSid = process.env.TWILIO_ACCOUNT_SID;9const apiKey = process.env.TWILIO_API_KEY;10const apiSecret = process.env.TWILIO_API_SECRET;11const client = twilio(apiKey, apiSecret, { accountSid: accountSid });1213async function createChannelSender() {14const channelSender = await client.messaging.v115.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")16.channelSenders.create({ sid: "XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" });1718console.log(channelSender.accountSid);19}2021createChannelSender();
Response
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}
GET https://messaging.twilio.com/v1/Services/{MessagingServiceSid}/ChannelSenders/{Sid}
The SID of the Service to fetch the resource from.
^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the ChannelSender resource to fetch.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID at twilio.com/console5// Provision API Keys at twilio.com/console/runtime/api-keys6// and set the environment variables. See http://twil.io/secure7// For local testing, you can use your Account SID and Auth token8const accountSid = process.env.TWILIO_ACCOUNT_SID;9const apiKey = process.env.TWILIO_API_KEY;10const apiSecret = process.env.TWILIO_API_SECRET;11const client = twilio(apiKey, apiSecret, { accountSid: accountSid });1213async function fetchChannelSender() {14const channelSender = await client.messaging.v115.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")16.channelSenders("XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")17.fetch();1819console.log(channelSender.accountSid);20}2122fetchChannelSender();
Response
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}
GET https://messaging.twilio.com/v1/Services/{MessagingServiceSid}/ChannelSenders
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1Maximum: 1000The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID at twilio.com/console5// Provision API Keys at twilio.com/console/runtime/api-keys6// and set the environment variables. See http://twil.io/secure7// For local testing, you can use your Account SID and Auth token8const accountSid = process.env.TWILIO_ACCOUNT_SID;9const apiKey = process.env.TWILIO_API_KEY;10const apiSecret = process.env.TWILIO_API_SECRET;11const client = twilio(apiKey, apiSecret, { accountSid: accountSid });1213async function listChannelSender() {14const channelSenders = await client.messaging.v115.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")16.channelSenders.list({ limit: 20 });1718channelSenders.forEach((c) => console.log(c.accountSid));19}2021listChannelSender();
Response
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 https://messaging.twilio.com/v1/Services/{MessagingServiceSid}/ChannelSenders/{Sid}
Returns "204 NO CONTENT" if the channel sender was successfully removed from the Service.
The SID of the Service to delete the resource from.
^MG[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Channel Sender resource to delete.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID at twilio.com/console5// Provision API Keys at twilio.com/console/runtime/api-keys6// and set the environment variables. See http://twil.io/secure7// For local testing, you can use your Account SID and Auth token8const accountSid = process.env.TWILIO_ACCOUNT_SID;9const apiKey = process.env.TWILIO_API_KEY;10const apiSecret = process.env.TWILIO_API_SECRET;11const client = twilio(apiKey, apiSecret, { accountSid: accountSid });1213async function deleteChannelSender() {14await client.messaging.v115.services("MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")16.channelSenders("XEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")17.remove();18}1920deleteChannelSender();