# Service-Scoped Notification Resource

The Twilio Conversations Service Notification resource manages a set of settings to determine [push notification Service Binding](/docs/conversations/api/service-binding-resource) behavior for a specific [Conversation Service](/docs/conversations/api/service-resource).

## API Base URL

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

```bash
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:

```bash
GET /v1/Services/ISxx/Conversations/CHxx/Messages

```

## Notification Properties

```json
{"type":"object","refName":"conversations.v1.service.service_configuration.service_notification","modelName":"conversations_v1_service_service_configuration_service_notification","properties":{"account_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$","nullable":true,"description":"The unique ID of the [Account](/docs/iam/api/account) responsible for this configuration."},"chat_service_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$","nullable":true,"description":"The SID of the [Conversation Service](/docs/conversations/api/service-resource) the Configuration applies to."},"new_message":{"nullable":true,"description":"The Push Notification configuration for New Messages."},"added_to_conversation":{"nullable":true,"description":"The Push Notification configuration for being added to a Conversation."},"removed_from_conversation":{"nullable":true,"description":"The Push Notification configuration for being removed from a Conversation."},"log_enabled":{"type":"boolean","nullable":true,"description":"Weather the notification logging is enabled."},"url":{"type":"string","format":"uri","nullable":true,"description":"An absolute API resource URL for this configuration."}}}
```

## Fetch a ServiceNotification resource

`GET https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Configuration/Notifications`

### Path parameters

```json
[{"name":"ChatServiceSid","in":"path","description":"The SID of the [Conversation Service](/docs/conversations/api/service-resource) the Configuration applies to.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$"},"required":true}]
```

Fetch a Notification

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function fetchServiceNotification() {
  const notification = await client.conversations.v1
    .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .configuration.notifications()
    .fetch();

  console.log(notification.accountSid);
}

fetchServiceNotification();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

notification = (
    client.conversations.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .configuration.notifications()
    .fetch()
)

print(notification.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Conversations.V1.Service.Configuration;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var notification = await NotificationResource.FetchAsync(
            pathChatServiceSid: "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(notification.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.conversations.v1.service.configuration.Notification;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Notification notification = Notification.fetcher("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").fetch();

        System.out.println(notification.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	resp, err := client.ConversationsV1.FetchServiceNotification("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} else {
			fmt.Println(resp.AccountSid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$notification = $twilio->conversations->v1
    ->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->configuration->notifications()
    ->fetch();

print $notification->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

notification = @client
               .conversations
               .v1
               .services('ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
               .configuration
               .notifications
               .fetch

puts notification.account_sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:conversations:v1:services:configuration:notifications:fetch \
   --chat-service-sid ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X GET "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Notifications" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

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

## Update a ServiceNotification resource

`POST https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Configuration/Notifications`

### Path parameters

```json
[{"name":"ChatServiceSid","in":"path","description":"The SID of the [Conversation Service](/docs/conversations/api/service-resource) the Configuration applies to.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"UpdateServiceNotificationRequest","properties":{"LogEnabled":{"type":"boolean","description":"Weather the notification logging is enabled."},"NewMessage.Enabled":{"type":"boolean","description":"Whether to send a notification when a new message is added to a conversation. The default is `false`."},"NewMessage.Template":{"type":"string","description":"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.Sound":{"type":"string","description":"The name of the sound to play when a new message is added to a conversation and `new_message.enabled` is `true`."},"NewMessage.BadgeCountEnabled":{"type":"boolean","description":"Whether the new message badge is enabled. The default is `false`."},"AddedToConversation.Enabled":{"type":"boolean","description":"Whether to send a notification when a participant is added to a conversation. The default is `false`."},"AddedToConversation.Template":{"type":"string","description":"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.Sound":{"type":"string","description":"The name of the sound to play when a participant is added to a conversation and `added_to_conversation.enabled` is `true`."},"RemovedFromConversation.Enabled":{"type":"boolean","description":"Whether to send a notification to a user when they are removed from a conversation. The default is `false`."},"RemovedFromConversation.Template":{"type":"string","description":"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.Sound":{"type":"string","description":"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.Enabled":{"type":"boolean","description":"Whether to send a notification when a new message with media/file attachments is added to a conversation. The default is `false`."},"NewMessage.WithMedia.Template":{"type":"string","description":"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`."}}},"examples":{"update":{"value":{"lang":"json","value":"{\n  \"NewMessage.Enabled\": false,\n  \"NewMessage.Template\": \"You have a new message in ${CONVERSATION} from ${PARTICIPANT}: ${MESSAGE}\",\n  \"NewMessage.Sound\": \"ring\",\n  \"NewMessage.BadgeCountEnabled\": true,\n  \"NewMessage.WithMedia.Enabled\": false,\n  \"NewMessage.WithMedia.Template\": \"You have a new message in ${CONVERSATION} with ${MEDIA_COUNT} media files: ${MEDIA}\",\n  \"AddedToConversation.Enabled\": false,\n  \"AddedToConversation.Template\": \"You have been added to a Conversation: ${CONVERSATION}\",\n  \"AddedToConversation.Sound\": \"ring\",\n  \"RemovedFromConversation.Enabled\": false,\n  \"RemovedFromConversation.Template\": \"You have been removed from a Conversation: ${CONVERSATION}\",\n  \"RemovedFromConversation.Sound\": \"ring\",\n  \"LogEnabled\": true\n}","meta":"","code":"{\n  \"NewMessage.Enabled\": false,\n  \"NewMessage.Template\": \"You have a new message in ${CONVERSATION} from ${PARTICIPANT}: ${MESSAGE}\",\n  \"NewMessage.Sound\": \"ring\",\n  \"NewMessage.BadgeCountEnabled\": true,\n  \"NewMessage.WithMedia.Enabled\": false,\n  \"NewMessage.WithMedia.Template\": \"You have a new message in ${CONVERSATION} with ${MEDIA_COUNT} media files: ${MEDIA}\",\n  \"AddedToConversation.Enabled\": false,\n  \"AddedToConversation.Template\": \"You have been added to a Conversation: ${CONVERSATION}\",\n  \"AddedToConversation.Sound\": \"ring\",\n  \"RemovedFromConversation.Enabled\": false,\n  \"RemovedFromConversation.Template\": \"You have been removed from a Conversation: ${CONVERSATION}\",\n  \"RemovedFromConversation.Sound\": \"ring\",\n  \"LogEnabled\": true\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"NewMessage.Enabled\"","#7EE787"],[":","#C9D1D9"]," ",["false","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"NewMessage.Template\"","#7EE787"],[":","#C9D1D9"]," ",["\"You have a new message in ${CONVERSATION} from ${PARTICIPANT}: ${MESSAGE}\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"NewMessage.Sound\"","#7EE787"],[":","#C9D1D9"]," ",["\"ring\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"NewMessage.BadgeCountEnabled\"","#7EE787"],[":","#C9D1D9"]," ",["true","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"NewMessage.WithMedia.Enabled\"","#7EE787"],[":","#C9D1D9"]," ",["false","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"NewMessage.WithMedia.Template\"","#7EE787"],[":","#C9D1D9"]," ",["\"You have a new message in ${CONVERSATION} with ${MEDIA_COUNT} media files: ${MEDIA}\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"AddedToConversation.Enabled\"","#7EE787"],[":","#C9D1D9"]," ",["false","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"AddedToConversation.Template\"","#7EE787"],[":","#C9D1D9"]," ",["\"You have been added to a Conversation: ${CONVERSATION}\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"AddedToConversation.Sound\"","#7EE787"],[":","#C9D1D9"]," ",["\"ring\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"RemovedFromConversation.Enabled\"","#7EE787"],[":","#C9D1D9"]," ",["false","#79C0FF"],[",","#C9D1D9"],"\n  ",["\"RemovedFromConversation.Template\"","#7EE787"],[":","#C9D1D9"]," ",["\"You have been removed from a Conversation: ${CONVERSATION}\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"RemovedFromConversation.Sound\"","#7EE787"],[":","#C9D1D9"]," ",["\"ring\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"LogEnabled\"","#7EE787"],[":","#C9D1D9"]," ",["true","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Update a Notification

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function updateServiceNotification() {
  const notification = await client.conversations.v1
    .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .configuration.notifications()
    .update({ logEnabled: false });

  console.log(notification.accountSid);
}

updateServiceNotification();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

service_notification = (
    client.conversations.v1.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    .configuration.notifications()
    .update(log_enabled=False)
)

print(service_notification.account_sid)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Conversations.V1.Service.Configuration;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var notification = await NotificationResource.UpdateAsync(
            logEnabled: false, pathChatServiceSid: "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        Console.WriteLine(notification.AccountSid);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.conversations.v1.service.configuration.Notification;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Notification notification =
            Notification.updater("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").setLogEnabled(false).update();

        System.out.println(notification.getAccountSid());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	conversations "github.com/twilio/twilio-go/rest/conversations/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &conversations.UpdateServiceNotificationParams{}
	params.SetLogEnabled(false)

	resp, err := client.ConversationsV1.UpdateServiceNotification("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.AccountSid != nil {
			fmt.Println(*resp.AccountSid)
		} else {
			fmt.Println(resp.AccountSid)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$service_notification = $twilio->conversations->v1
    ->services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
    ->configuration->notifications()
    ->update(["logEnabled" => false]);

print $service_notification->accountSid;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

notification = @client
               .conversations
               .v1
               .services('ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
               .configuration
               .notifications
               .update(log_enabled: false)

puts notification.account_sid
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:conversations:v1:services:configuration:notifications:update \
   --chat-service-sid ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
```

```bash
curl -X POST "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Configuration/Notifications" \
--data-urlencode "LogEnabled=false" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

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