Service-Scoped Notification Resource
The Twilio Conversations (classic) Service Notification resource manages a set of settings to determine push notification Service Binding behavior for a specific Conversation Service.
All URLs in the reference documentation use the following base URL:
1https://conversations.twilio.com/v12
For Conversations (classic) applications that build on more than one Conversation Service instance, you will need to specify the Conversation Service SID in the REST API call:
1GET /v1/Services/ISxx/Conversations/CHxx/Messages2
The unique ID of the Account responsible for this configuration.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Conversation Service the Configuration applies to.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The Push Notification configuration for being added to a Conversation.
The Push Notification configuration for being removed from a Conversation.
An absolute API resource URL for this configuration.
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Configuration/Notifications
The SID of the Conversation Service the Configuration applies to.
^IS[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 fetchServiceNotification() {14const notification = await client.conversations.v115.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")16.configuration.notifications()17.fetch();1819console.log(notification.accountSid);20}2122fetchServiceNotification();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"log_enabled": false,5"added_to_conversation": {6"enabled": true,7"template": "You have been added to a Conversation: ${CONVERSATION}",8"sound": "ring"9},10"new_message": {11"enabled": true,12"template": "You have a new message in ${CONVERSATION} from ${PARTICIPANT}: ${MESSAGE}",13"badge_count_enabled": false,14"sound": "ring",15"with_media": {16"enabled": false,17"template": "You have a new message in ${CONVERSATION} with ${MEDIA_COUNT} media files: ${MEDIA}"18}19},20"removed_from_conversation": {21"enabled": true,22"template": "You have been removed from a Conversation: ${CONVERSATION}",23"sound": "ring"24},25"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Notifications"26}
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Configuration/Notifications
The SID of the Conversation Service the Configuration applies to.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34application/x-www-form-urlencodedWhether to send a notification when a new message is added to a conversation. The default is false.
The template to use to create the notification text displayed when a new message is added to a conversation and new_message.enabled is true.
The name of the sound to play when a new message is added to a conversation and new_message.enabled is true.
Whether the new message badge is enabled. The default is false.
Whether to send a notification when a participant is added to a conversation. The default is false.
The template to use to create the notification text displayed when a participant is added to a conversation and added_to_conversation.enabled is true.
The name of the sound to play when a participant is added to a conversation and added_to_conversation.enabled is true.
Whether to send a notification to a user when they are removed from a conversation. The default is false.
The template to use to create the notification text displayed to a user when they are removed from a conversation and removed_from_conversation.enabled is true.
The name of the sound to play to a user when they are removed from a conversation and removed_from_conversation.enabled is true.
Whether to send a notification when a new message with media/file attachments is added to a conversation. The default is false.
The template to use to create the notification text displayed when a new message with media/file attachments is added to a conversation and new_message.attachments.enabled is true.
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 updateServiceNotification() {14const notification = await client.conversations.v115.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")16.configuration.notifications()17.update({ logEnabled: false });1819console.log(notification.accountSid);20}2122updateServiceNotification();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"log_enabled": false,5"added_to_conversation": {6"enabled": false,7"template": "You have been added to a Conversation: ${CONVERSATION}",8"sound": "ring"9},10"new_message": {11"enabled": false,12"template": "You have a new message in ${CONVERSATION} from ${PARTICIPANT}: ${MESSAGE}",13"badge_count_enabled": true,14"sound": "ring",15"with_media": {16"enabled": false,17"template": "You have a new message in ${CONVERSATION} with ${MEDIA_COUNT} media files: ${MEDIA}"18}19},20"removed_from_conversation": {21"enabled": false,22"template": "You have been removed from a Conversation: ${CONVERSATION}",23"sound": "ring"24},25"url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Notifications"26}