Programmable Chat has been deprecated and is no longer supported. 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.
A Service is the top-level scope of all other resources in the Programmable Chat REST API. All other Programmable Chat resources, such as Channels, Users, Messages, and Credentials belong to a specific Service.
Services allow you to:
A Service can also send HTTPS requests to URLs that you define to let you know of specific events. See what events you can subscribe to in our webhook reference.
You can also manage your Programmable Chat Services from your Twilio console when you are logged in.
The Service resource contains these properties.
The unique string that we created to identify the Service resource.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the Service resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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 service role assigned to users when they are added to the service. See the Role resource for more info about roles.
^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The channel role assigned to users when they are added to a channel. See the Role resource for more info about roles.
^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The channel role assigned to a channel creator when they join a new channel. See the Role resource for more info about roles.
^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Whether the Message Consumption Horizon feature is enabled. The default is true
.
Whether the Reachability Indicator is enabled for this Service instance. The default is false
.
How long in seconds after a started typing
event until clients should assume that user is no longer typing, even if no ended typing
message was received. The default is 5 seconds.
0
DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints.
0
An object that describes the limits of the service instance. The limits
object contains channel_members
to describe the members/channel limit and user_channels
to describe the channels/user limit. channel_members
can be 1,000 or less, with a default of 250. user_channels
can be 1,000 or less, with a default value of 100.
The URL for pre-event webhooks, which are called by using the webhook_method
. See Webhook Events for more details.
The URL for post-event webhooks, which are called by using the webhook_method
. See Webhook Events for more details.
The HTTP method to use for calls to the pre_webhook_url
and post_webhook_url
webhooks. Can be: POST
or GET
and the default is POST
. See Webhook Events for more details.
The list of webhook events that are enabled for this Service instance. See Webhook Events for more details.
The number of times to retry a call to the pre_webhook_url
if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried.
0
The number of times to retry a call to the post_webhook_url
if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried.
0
The notification configuration for the Service instance. See Push Notification Configuration for more info.
An object that describes the properties of media that the service supports. The object contains the size_limit_mb
property, which describes the size of the largest media file in MB; and the compatibility_message
property, which contains the message text to send when a media message does not have any text.
POST https://chat.twilio.com/v2/Services
application/x-www-form-urlencoded
A descriptive string that you create to describe the new resource.
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 and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createService() {11const service = await client.chat.v2.services.create({12friendlyName: "FriendlyName",13});1415console.log(service.sid);16}1718createService();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"consumption_report_interval": 100,4"date_created": "2015-07-30T20:00:00Z",5"date_updated": "2015-07-30T20:00:00Z",6"default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"friendly_name": "FriendlyName",10"limits": {11"channel_members": 100,12"user_channels": 25013},14"links": {15"channels": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",16"users": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users",17"roles": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",18"bindings": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings"19},20"notifications": {},21"post_webhook_url": "post_webhook_url",22"pre_webhook_url": "pre_webhook_url",23"pre_webhook_retry_count": 2,24"post_webhook_retry_count": 3,25"reachability_enabled": false,26"read_status_enabled": false,27"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"typing_indicator_timeout": 100,29"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",30"webhook_filters": [31"webhook_filters"32],33"webhook_method": "webhook_method",34"media": {35"size_limit_mb": 150,36"compatibility_message": "media compatibility message"37}38}
GET https://chat.twilio.com/v2/Services/{Sid}
The SID of the Service resource to fetch.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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 and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchService() {11const service = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.fetch();1415console.log(service.sid);16}1718fetchService();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"consumption_report_interval": 100,4"date_created": "2015-07-30T20:00:00Z",5"date_updated": "2015-07-30T20:00:00Z",6"default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"friendly_name": "friendly_name",10"limits": {11"channel_members": 100,12"user_channels": 25013},14"links": {15"channels": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",16"users": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users",17"roles": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",18"bindings": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings"19},20"notifications": {},21"post_webhook_url": "post_webhook_url",22"pre_webhook_url": "pre_webhook_url",23"pre_webhook_retry_count": 2,24"post_webhook_retry_count": 3,25"reachability_enabled": false,26"read_status_enabled": false,27"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",28"typing_indicator_timeout": 100,29"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",30"webhook_filters": [31"webhook_filters"32],33"webhook_method": "webhook_method",34"media": {35"size_limit_mb": 150,36"compatibility_message": "media compatibility message"37}38}
GET https://chat.twilio.com/v2/Services
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The 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 and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listService() {11const services = await client.chat.v2.services.list({ limit: 20 });1213services.forEach((s) => console.log(s.sid));14}1516listService();
1{2"meta": {3"first_page_url": "https://chat.twilio.com/v2/Services?PageSize=50&Page=0",4"key": "services",5"next_page_url": null,6"page": 0,7"page_size": 50,8"previous_page_url": null,9"url": "https://chat.twilio.com/v2/Services?PageSize=50&Page=0"10},11"services": []12}
POST https://chat.twilio.com/v2/Services/{Sid}
The SID of the Service resource to update.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
A descriptive string that you create to describe the resource.
The service role assigned to users when they are added to the service. See the Role resource for more info about roles.
^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The channel role assigned to users when they are added to a channel. See the Role resource for more info about roles.
^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The channel role assigned to a channel creator when they join a new channel. See the Role resource for more info about roles.
^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Whether to enable the Message Consumption Horizon feature. The default is true
.
Whether to enable the Reachability Indicator for this Service instance. The default is false
.
How long in seconds after a started typing
event until clients should assume that user is no longer typing, even if no ended typing
message was received. The default is 5 seconds.
DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints.
Whether to send a notification when a new message is added to a channel. The default is false
.
The template to use to create the notification text displayed when a new message is added to a channel and notifications.new_message.enabled
is true
.
The name of the sound to play when a new message is added to a channel and notifications.new_message.enabled
is true
.
Whether the new message badge is enabled. The default is false
.
Whether to send a notification when a member is added to a channel. The default is false
.
The template to use to create the notification text displayed when a member is added to a channel and notifications.added_to_channel.enabled
is true
.
The name of the sound to play when a member is added to a channel and notifications.added_to_channel.enabled
is true
.
Whether to send a notification to a user when they are removed from a channel. The default is false
.
The template to use to create the notification text displayed to a user when they are removed from a channel and notifications.removed_from_channel.enabled
is true
.
The name of the sound to play to a user when they are removed from a channel and notifications.removed_from_channel.enabled
is true
.
Whether to send a notification when a user is invited to a channel. The default is false
.
The template to use to create the notification text displayed when a user is invited to a channel and notifications.invited_to_channel.enabled
is true
.
The name of the sound to play when a user is invited to a channel and notifications.invited_to_channel.enabled
is true
.
The URL for pre-event webhooks, which are called by using the webhook_method
. See Webhook Events for more details.
The URL for post-event webhooks, which are called by using the webhook_method
. See Webhook Events for more details.
The HTTP method to use for calls to the pre_webhook_url
and post_webhook_url
webhooks. Can be: POST
or GET
and the default is POST
. See Webhook Events for more details.
GET
POST
The list of webhook events that are enabled for this Service instance. See Webhook Events for more details.
The maximum number of Members that can be added to Channels within this Service. Can be up to 1,000.
The maximum number of Channels Users can be a Member of within this Service. Can be up to 1,000.
The message to send when a media message has no text. Can be used as placeholder message.
The number of times to retry a call to the pre_webhook_url
if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried.
The number of times to retry a call to the post_webhook_url
if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried.
Whether to log notifications. The default is false
.
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 and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateService() {11const service = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.update({ friendlyName: "FriendlyName" });1415console.log(service.sid);16}1718updateService();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"consumption_report_interval": 100,4"date_created": "2015-07-30T20:00:00Z",5"date_updated": "2015-07-30T20:00:00Z",6"default_channel_creator_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",7"default_channel_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"default_service_role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"friendly_name": "FriendlyName",10"limits": {11"channel_members": 500,12"user_channels": 60013},14"links": {15"channels": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels",16"users": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Users",17"roles": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Roles",18"bindings": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Bindings"19},20"notifications": {21"log_enabled": true,22"added_to_channel": {23"enabled": false,24"template": "notifications.added_to_channel.template"25},26"invited_to_channel": {27"enabled": false,28"template": "notifications.invited_to_channel.template"29},30"new_message": {31"enabled": false,32"template": "notifications.new_message.template",33"badge_count_enabled": true34},35"removed_from_channel": {36"enabled": false,37"template": "notifications.removed_from_channel.template"38}39},40"post_webhook_url": "post_webhook_url",41"pre_webhook_url": "pre_webhook_url",42"pre_webhook_retry_count": 2,43"post_webhook_retry_count": 3,44"reachability_enabled": false,45"read_status_enabled": false,46"sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",47"typing_indicator_timeout": 100,48"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",49"webhook_filters": [50"webhook_filters"51],52"webhook_method": "webhook_method",53"media": {54"size_limit_mb": 150,55"compatibility_message": "new media compatibility message"56}57}
DELETE https://chat.twilio.com/v2/Services/{Sid}
The SID of the Service resource to delete.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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 and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteService() {11await client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").remove();12}1314deleteService();