The Twilio Conversations 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 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: 34
Max length: 34
The SID of the Conversation Service the Configuration applies to.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The 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: 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 fetchServiceNotification() {11const notification = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.configuration.notifications()14.fetch();1516console.log(notification.accountSid);17}1819fetchServiceNotification();
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: 34
Max length: 34
application/x-www-form-urlencoded
Whether 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 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 updateServiceNotification() {11const notification = await client.conversations.v112.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.configuration.notifications()14.update({ logEnabled: false });1516console.log(notification.accountSid);17}1819updateServiceNotification();
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}