Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Service-Scoped Notification Resource


The Twilio Conversations Service Notification resource manages a set of settings to determine push notification Service Binding behavior for a specific Conversation Service.


API Base URL

api-base-url page anchor

All URLs in the reference documentation use the following base URL:


_10
https://conversations.twilio.com/v1

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:


_10
GET /v1/Services/ISxx/Conversations/CHxx/Messages


ServiceNotification Properties

servicenotification-properties page anchor
Resource properties
account_sidtype: SID<AC>Not PII

chat_service_sidtype: SID<IS>Not PII

The SID of the Conversation Service(link takes you to an external page) the Configuration applies to.


new_messagetype: objectNot PII

The Push Notification configuration for New Messages.


added_to_conversationtype: objectNot PII

The Push Notification configuration for being added to a Conversation.


removed_from_conversationtype: objectNot PII

The Push Notification configuration for being removed from a Conversation.


log_enabledtype: booleanNot PII

Weather the notification logging is enabled.


urltype: string<URI>Not PII

An absolute API resource URL for this configuration.


Fetch a ServiceNotification resource

fetch-a-servicenotification-resource page anchor
GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Configuration/Notifications

Parameters

fetch-parameters page anchor
URI parameters
ChatServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Conversation Service(link takes you to an external page) the Configuration applies to.

Fetch a ServiceNotification

fetch-a-servicenotification page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.configuration
_12
.notifications()
_12
.fetch()
_12
.then(notification => console.log(notification.chatServiceSid));

Output

_26
{
_26
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"log_enabled": false,
_26
"added_to_conversation": {
_26
"enabled": true,
_26
"template": "You have been added to a Conversation: ${CONVERSATION}",
_26
"sound": "ring"
_26
},
_26
"new_message": {
_26
"enabled": true,
_26
"template": "You have a new message in ${CONVERSATION} from ${PARTICIPANT}: ${MESSAGE}",
_26
"badge_count_enabled": false,
_26
"sound": "ring",
_26
"with_media": {
_26
"enabled": false,
_26
"template": "You have a new message in ${CONVERSATION} with ${MEDIA_COUNT} media files: ${MEDIA}"
_26
}
_26
},
_26
"removed_from_conversation": {
_26
"enabled": true,
_26
"template": "You have been removed from a Conversation: ${CONVERSATION}",
_26
"sound": "ring"
_26
},
_26
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configuration/Notifications"
_26
}


Update a ServiceNotification resource

update-a-servicenotification-resource page anchor
POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Configuration/Notifications

URI parameters
ChatServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Conversation Service(link takes you to an external page) the Configuration applies to.


Request body parameters
LogEnabledtype: booleanNot PII

Weather the notification logging is enabled.


NewMessage.Enabledtype: booleanNot PII

Whether to send a notification when a new message is added to a conversation. The default is false.


NewMessage.Templatetype: stringNot PII

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.


NewMessage.Soundtype: stringNot PII

The name of the sound to play when a new message is added to a conversation and new_message.enabled is true.


NewMessage.BadgeCountEnabledtype: booleanNot PII

Whether the new message badge is enabled. The default is false.


AddedToConversation.Enabledtype: booleanNot PII

Whether to send a notification when a participant is added to a conversation. The default is false.


AddedToConversation.Templatetype: stringNot PII

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.


AddedToConversation.Soundtype: stringNot PII

The name of the sound to play when a participant is added to a conversation and added_to_conversation.enabled is true.


RemovedFromConversation.Enabledtype: booleanNot PII

Whether to send a notification to a user when they are removed from a conversation. The default is false.


RemovedFromConversation.Templatetype: stringNot PII

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.


RemovedFromConversation.Soundtype: stringNot PII

The name of the sound to play to a user when they are removed from a conversation and removed_from_conversation.enabled is true.


NewMessage.WithMedia.Enabledtype: booleanNot PII

Whether to send a notification when a new message with media/file attachments is added to a conversation. The default is false.


NewMessage.WithMedia.Templatetype: stringNot PII

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.

Update a ServiceNotification

update-a-servicenotification page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.conversations.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.configuration
_12
.notifications()
_12
.update({logEnabled: true})
_12
.then(notification => console.log(notification.chatServiceSid));

Output

_26
{
_26
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"chat_service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"log_enabled": true,
_26
"added_to_conversation": {
_26
"enabled": false,
_26
"template": "You have been added to a Conversation: ${CONVERSATION}",
_26
"sound": "ring"
_26
},
_26
"new_message": {
_26
"enabled": false,
_26
"template": "You have a new message in ${CONVERSATION} from ${PARTICIPANT}: ${MESSAGE}",
_26
"badge_count_enabled": true,
_26
"sound": "ring",
_26
"with_media": {
_26
"enabled": false,
_26
"template": "You have a new message in ${CONVERSATION} with ${MEDIA_COUNT} media files: ${MEDIA}"
_26
}
_26
},
_26
"removed_from_conversation": {
_26
"enabled": false,
_26
"template": "You have been removed from a Conversation: ${CONVERSATION}",
_26
"sound": "ring"
_26
},
_26
"url": "https://conversations.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Configuration/Notifications"
_26
}


Rate this page: