# User Conversation Resource

The UserConversation resource lists the [Conversations](/docs/conversations/api/conversation-resource) in which a particular User is an active Participant. Use this resource to:

* list a user's conversations, present or historical,
* mute a user's push notifications for specific channels, or
* count a user's unread messages

> \[!NOTE]
>
> UnreadMessageCount returns a maximum value of 1000

## Conversation Properties

Each UserConversation resource contains these properties.

```json
{"type":"object","refName":"conversations.v1.user.user_conversation","modelName":"conversations_v1_user_user_conversation","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 conversation."},"chat_service_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^IS[0-9a-fA-F]{32}$","nullable":true,"description":"The unique ID of the [Conversation Service](/docs/conversations/api/service-resource) this conversation belongs to."},"conversation_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^CH[0-9a-fA-F]{32}$","nullable":true,"description":"The unique ID of the [Conversation](/docs/conversations/api/conversation-resource) for this User Conversation."},"unread_messages_count":{"type":"integer","nullable":true,"description":"The number of unread Messages in the Conversation for the Participant."},"last_read_message_index":{"type":"integer","nullable":true,"description":"The index of the last Message in the Conversation that the Participant has read."},"participant_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^MB[0-9a-fA-F]{32}$","nullable":true,"description":"The unique ID of the [participant](/docs/conversations/api/conversation-participant-resource) the user conversation belongs to."},"user_sid":{"type":"string","minLength":34,"maxLength":34,"pattern":"^US[0-9a-fA-F]{32}$","nullable":true,"description":"The unique string that identifies the [User resource](/docs/conversations/api/user-resource)."},"friendly_name":{"type":"string","nullable":true,"description":"The human-readable name of this conversation, limited to 256 characters. Optional.","x-twilio":{"pii":{"handling":"standard","deleteSla":30}}},"conversation_state":{"type":"string","enum":["inactive","active","closed"],"description":"The current state of this User Conversation. One of `inactive`, `active` or `closed`.","refName":"user_conversation_enum_state","modelName":"user_conversation_enum_state"},"timers":{"nullable":true,"description":"Timer date values representing state update for this conversation."},"attributes":{"type":"string","nullable":true,"description":"An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified.  **Note** that if the attributes are not set \"{}\" will be returned.","x-twilio":{"pii":{"handling":"sensitive","deleteSla":30}}},"date_created":{"type":"string","format":"date-time","nullable":true,"description":"The date that this conversation was created, given in ISO 8601 format."},"date_updated":{"type":"string","format":"date-time","nullable":true,"description":"The date that this conversation was last updated, given in ISO 8601 format."},"created_by":{"type":"string","nullable":true,"description":"Identity of the creator of this Conversation."},"notification_level":{"type":"string","enum":["default","muted"],"description":"The Notification Level of this User Conversation. One of `default` or `muted`.","refName":"user_conversation_enum_notification_level","modelName":"user_conversation_enum_notification_level"},"unique_name":{"type":"string","nullable":true,"description":"An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL.","x-twilio":{"pii":{"handling":"standard","deleteSla":30}}},"url":{"type":"string","format":"uri","nullable":true},"links":{"type":"object","format":"uri-map","nullable":true,"description":"Contains absolute URLs to access the [participant](/docs/conversations/api/conversation-participant-resource) and [conversation](/docs/conversations/api/conversation-resource) of this conversation."}}}
```

## Fetch a specific conversation

`GET https://conversations.twilio.com/v1/Users/{UserSid}/Conversations/{ConversationSid}`

The `{UserSid}` value can be either the `sid` or the `identity` of the User resource and the `{ConversationSid}` value can be either the `sid` or the `unique_name` of the Conversation to fetch.

{" "}

### Path parameters

```json
[{"name":"UserSid","in":"path","description":"The unique SID identifier of the [User resource](/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.","schema":{"type":"string"},"required":true},{"name":"ConversationSid","in":"path","description":"The unique SID identifier of the Conversation. This value can be either the `sid` or the `unique_name` of the [Conversation resource](/docs/conversations/api/conversation-resource).","schema":{"type":"string"},"required":true}]
```

Fetch a specific conversation

```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 fetchUserConversation() {
  const userConversation = await client.conversations.v1
    .users("USXXXXXXXXXXXXX")
    .userConversations("CHXXXXXXXXXXXXX")
    .fetch();

  console.log(userConversation.accountSid);
}

fetchUserConversation();
```

```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)

user_conversation = (
    client.conversations.v1.users("USXXXXXXXXXXXXX")
    .user_conversations("CHXXXXXXXXXXXXX")
    .fetch()
)

print(user_conversation.account_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Conversations.V1.User;
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 userConversation = await UserConversationResource.FetchAsync(
            pathUserSid: "USXXXXXXXXXXXXX", pathConversationSid: "CHXXXXXXXXXXXXX");

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

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

import com.twilio.Twilio;
import com.twilio.rest.conversations.v1.user.UserConversation;

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);
        UserConversation userConversation = UserConversation.fetcher("USXXXXXXXXXXXXX", "CHXXXXXXXXXXXXX").fetch();

        System.out.println(userConversation.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.FetchUserConversation("USXXXXXXXXXXXXX",
		"CHXXXXXXXXXXXXX")
	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);

$user_conversation = $twilio->conversations->v1
    ->users("USXXXXXXXXXXXXX")
    ->userConversations("CHXXXXXXXXXXXXX")
    ->fetch();

print $user_conversation->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)

user_conversation = @client
                    .conversations
                    .v1
                    .users('USXXXXXXXXXXXXX')
                    .user_conversations('CHXXXXXXXXXXXXX')
                    .fetch

puts user_conversation.account_sid
```

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

twilio api:conversations:v1:users:conversations:fetch \
   --user-sid USXXXXXXXXXXXXX \
   --conversation-sid CHXXXXXXXXXXXXX
```

```bash
curl -X GET "https://conversations.twilio.com/v1/Users/USXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXX" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "conversation_sid": "CHXXXXXXXXXXXXX",
  "unread_messages_count": 100,
  "last_read_message_index": 100,
  "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "user_sid": "USXXXXXXXXXXXXX",
  "friendly_name": "friendly_name",
  "conversation_state": "inactive",
  "timers": {
    "date_inactive": "2015-12-16T22:19:38Z",
    "date_closed": "2015-12-16T22:28:38Z"
  },
  "attributes": "{}",
  "date_created": "2015-07-30T20:00:00Z",
  "date_updated": "2015-07-30T20:00:00Z",
  "created_by": "created_by",
  "notification_level": "default",
  "unique_name": "unique_name",
  "url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "links": {
    "participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  }
}
```

## List All of a User's Conversations

`GET https://conversations.twilio.com/v1/Users/{UserSid}/Conversations`

The `{UserSid}` value can be either the `sid` or the `identity` of the User resource to read UserConversation resources from.

{" "}

### Path parameters

```json
[{"name":"UserSid","in":"path","description":"The unique SID identifier of the [User resource](/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.","schema":{"type":"string"},"required":true}]
```

### Query parameters

```json
[{"name":"PageSize","in":"query","description":"How many resources to return in each list page. The default is 50, and the maximum is 50.","schema":{"type":"integer","format":"int64","minimum":1,"maximum":50}},{"name":"Page","in":"query","description":"The page index. This value is simply for client state.","schema":{"type":"integer","minimum":0}},{"name":"PageToken","in":"query","description":"The page token. This is provided by the API.","schema":{"type":"string"}}]
```

List All of a User's Conversations

```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 listUserConversation() {
  const userConversations = await client.conversations.v1
    .users("USXXXXXXXXXXXXX")
    .userConversations.list({ limit: 20 });

  userConversations.forEach((u) => console.log(u.accountSid));
}

listUserConversation();
```

```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)

user_conversations = client.conversations.v1.users(
    "USXXXXXXXXXXXXX"
).user_conversations.list(limit=20)

for record in user_conversations:
    print(record.account_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Conversations.V1.User;
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 userConversations =
            await UserConversationResource.ReadAsync(pathUserSid: "USXXXXXXXXXXXXX", limit: 20);

        foreach (var record in userConversations) {
            Console.WriteLine(record.AccountSid);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.conversations.v1.user.UserConversation;
import com.twilio.base.ResourceSet;

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);
        ResourceSet<UserConversation> userConversations = UserConversation.reader("USXXXXXXXXXXXXX").limit(20).read();

        for (UserConversation record : userConversations) {
            System.out.println(record.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.ListUserConversationParams{}
	params.SetLimit(20)

	resp, err := client.ConversationsV1.ListUserConversation("USXXXXXXXXXXXXX",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].AccountSid != nil {
				fmt.Println(*resp[record].AccountSid)
			} else {
				fmt.Println(resp[record].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);

$userConversations = $twilio->conversations->v1
    ->users("USXXXXXXXXXXXXX")
    ->userConversations->read(20);

foreach ($userConversations as $record) {
    print $record->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)

user_conversations = @client
                     .conversations
                     .v1
                     .users('USXXXXXXXXXXXXX')
                     .user_conversations
                     .list(limit: 20)

user_conversations.each do |record|
   puts record.account_sid
end
```

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

twilio api:conversations:v1:users:conversations:list \
   --user-sid USXXXXXXXXXXXXX
```

```bash
curl -X GET "https://conversations.twilio.com/v1/Users/USXXXXXXXXXXXXX/Conversations?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "conversations": [],
  "meta": {
    "page": 0,
    "page_size": 50,
    "first_page_url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations?PageSize=50&Page=0",
    "previous_page_url": null,
    "url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations?PageSize=50&Page=0",
    "next_page_url": null,
    "key": "conversations"
  }
}
```

## Update a specific conversation

`POST https://conversations.twilio.com/v1/Users/{UserSid}/Conversations/{ConversationSid}`

### Path parameters

```json
[{"name":"UserSid","in":"path","description":"The unique SID identifier of the [User resource](/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.","schema":{"type":"string"},"required":true},{"name":"ConversationSid","in":"path","description":"The unique SID identifier of the Conversation. This value can be either the `sid` or the `unique_name` of the [Conversation resource](/docs/conversations/api/conversation-resource).","schema":{"type":"string"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"UpdateUserConversationRequest","properties":{"NotificationLevel":{"type":"string","enum":["default","muted"],"description":"The Notification Level of this User Conversation. One of `default` or `muted`.","refName":"user_conversation_enum_notification_level","modelName":"user_conversation_enum_notification_level"},"LastReadTimestamp":{"type":"string","format":"date-time","description":"The date of the last message read in conversation by the user, given in ISO 8601 format."},"LastReadMessageIndex":{"type":"integer","nullable":true,"description":"The index of the last Message in the Conversation that the Participant has read."}}},"examples":{"update":{"value":{"lang":"json","value":"{\n  \"NotificationLevel\": \"default\",\n  \"LastReadTimestamp\": \"2015-07-30T20:00:00Z\",\n  \"LastReadMessageIndex\": 100\n}","meta":"","code":"{\n  \"NotificationLevel\": \"default\",\n  \"LastReadTimestamp\": \"2015-07-30T20:00:00Z\",\n  \"LastReadMessageIndex\": 100\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"NotificationLevel\"","#7EE787"],[":","#C9D1D9"]," ",["\"default\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"LastReadTimestamp\"","#7EE787"],[":","#C9D1D9"]," ",["\"2015-07-30T20:00:00Z\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"LastReadMessageIndex\"","#7EE787"],[":","#C9D1D9"]," ",["100","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Update a specific conversation

```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 updateUserConversation() {
  const userConversation = await client.conversations.v1
    .users("USXXXXXXXXXXXXX")
    .userConversations("CHXXXXXXXXXXXXX")
    .update({ notificationLevel: "default" });

  console.log(userConversation.accountSid);
}

updateUserConversation();
```

```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)

user_conversation = (
    client.conversations.v1.users("USXXXXXXXXXXXXX")
    .user_conversations("CHXXXXXXXXXXXXX")
    .update(notification_level="default")
)

print(user_conversation.account_sid)
```

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

using System;
using Twilio;
using Twilio.Rest.Conversations.V1.User;
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 userConversation = await UserConversationResource.UpdateAsync(
            notificationLevel: UserConversationResource.NotificationLevelEnum.Default,
            pathUserSid: "USXXXXXXXXXXXXX",
            pathConversationSid: "CHXXXXXXXXXXXXX");

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

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

import com.twilio.Twilio;
import com.twilio.rest.conversations.v1.user.UserConversation;

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);
        UserConversation userConversation = UserConversation.updater("USXXXXXXXXXXXXX", "CHXXXXXXXXXXXXX")
                                                .setNotificationLevel(UserConversation.NotificationLevel.DEFAULT)
                                                .update();

        System.out.println(userConversation.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.UpdateUserConversationParams{}
	params.SetNotificationLevel("default")

	resp, err := client.ConversationsV1.UpdateUserConversation("USXXXXXXXXXXXXX",
		"CHXXXXXXXXXXXXX",
		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);

$user_conversation = $twilio->conversations->v1
    ->users("USXXXXXXXXXXXXX")
    ->userConversations("CHXXXXXXXXXXXXX")
    ->update(["notificationLevel" => "default"]);

print $user_conversation->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)

user_conversation = @client
                    .conversations
                    .v1
                    .users('USXXXXXXXXXXXXX')
                    .user_conversations('CHXXXXXXXXXXXXX')
                    .update(notification_level: 'default')

puts user_conversation.account_sid
```

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

twilio api:conversations:v1:users:conversations:update \
   --user-sid USXXXXXXXXXXXXX \
   --conversation-sid CHXXXXXXXXXXXXX \
   --notification-level default
```

```bash
curl -X POST "https://conversations.twilio.com/v1/Users/USXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXX" \
--data-urlencode "NotificationLevel=default" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "conversation_sid": "CHXXXXXXXXXXXXX",
  "unread_messages_count": 100,
  "last_read_message_index": 100,
  "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "user_sid": "USXXXXXXXXXXXXX",
  "friendly_name": "friendly_name",
  "conversation_state": "inactive",
  "timers": {
    "date_inactive": "2015-12-16T22:19:38Z",
    "date_closed": "2015-12-16T22:28:38Z"
  },
  "attributes": "{}",
  "date_created": "2015-07-30T20:00:00Z",
  "date_updated": "2015-07-30T20:00:00Z",
  "created_by": "created_by",
  "notification_level": "default",
  "unique_name": "unique_name",
  "url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "links": {
    "participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  }
}
```

## Set the NotificationLevel for a conversation

`POST https://conversations.twilio.com/v1/Users/{UserSid}/Conversations/{ConversationSid}`

The `NotificationLevel` property expresses whether a user receives pushes for this conversation or not. This can be set separately for each user/conversation pair.

{" "}

### Path parameters

```json
[{"name":"UserSid","in":"path","description":"The unique SID identifier of the [User resource](/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.","schema":{"type":"string"},"required":true},{"name":"ConversationSid","in":"path","description":"The unique SID identifier of the Conversation. This value can be either the `sid` or the `unique_name` of the [Conversation resource](/docs/conversations/api/conversation-resource).","schema":{"type":"string"},"required":true}]
```

### Request body parameters

```json
{"schema":{"type":"object","title":"UpdateUserConversationRequest","properties":{"NotificationLevel":{"type":"string","enum":["default","muted"],"description":"The Notification Level of this User Conversation. One of `default` or `muted`.","refName":"user_conversation_enum_notification_level","modelName":"user_conversation_enum_notification_level"},"LastReadTimestamp":{"type":"string","format":"date-time","description":"The date of the last message read in conversation by the user, given in ISO 8601 format."},"LastReadMessageIndex":{"type":"integer","nullable":true,"description":"The index of the last Message in the Conversation that the Participant has read."}}},"examples":{"update":{"value":{"lang":"json","value":"{\n  \"NotificationLevel\": \"default\",\n  \"LastReadTimestamp\": \"2015-07-30T20:00:00Z\",\n  \"LastReadMessageIndex\": 100\n}","meta":"","code":"{\n  \"NotificationLevel\": \"default\",\n  \"LastReadTimestamp\": \"2015-07-30T20:00:00Z\",\n  \"LastReadMessageIndex\": 100\n}","tokens":[["{","#C9D1D9"],"\n  ",["\"NotificationLevel\"","#7EE787"],[":","#C9D1D9"]," ",["\"default\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"LastReadTimestamp\"","#7EE787"],[":","#C9D1D9"]," ",["\"2015-07-30T20:00:00Z\"","#A5D6FF"],[",","#C9D1D9"],"\n  ",["\"LastReadMessageIndex\"","#7EE787"],[":","#C9D1D9"]," ",["100","#79C0FF"],"\n",["}","#C9D1D9"]],"annotations":[],"themeName":"github-dark","style":{"color":"#c9d1d9","background":"#0d1117"}}}},"encodingType":"application/x-www-form-urlencoded","conditionalParameterMap":{}}
```

Mute Notifications for a Conversation

```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 updateUserConversation() {
  const userConversation = await client.conversations.v1
    .users("UserSid")
    .userConversations("ConversationSid")
    .update({ notificationLevel: "muted" });

  console.log(userConversation.notificationLevel);
}

updateUserConversation();
```

```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)

user_conversation = (
    client.conversations.v1.users("UserSid")
    .user_conversations("ConversationSid")
    .update(notification_level="muted")
)

print(user_conversation.notification_level)
```

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

using System;
using Twilio;
using Twilio.Rest.Conversations.V1.User;
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 userConversation = await UserConversationResource.UpdateAsync(
            notificationLevel: UserConversationResource.NotificationLevelEnum.Muted,
            pathUserSid: "UserSid",
            pathConversationSid: "ConversationSid");

        Console.WriteLine(userConversation.NotificationLevel);
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.conversations.v1.user.UserConversation;

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);
        UserConversation userConversation = UserConversation.updater("UserSid", "ConversationSid")
                                                .setNotificationLevel(UserConversation.NotificationLevel.MUTED)
                                                .update();

        System.out.println(userConversation.getNotificationLevel());
    }
}
```

```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.UpdateUserConversationParams{}
	params.SetNotificationLevel("muted")

	resp, err := client.ConversationsV1.UpdateUserConversation("UserSid",
		"ConversationSid",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.NotificationLevel != nil {
			fmt.Println(resp.NotificationLevel)
		} else {
			fmt.Println(resp.NotificationLevel)
		}
	}
}
```

```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);

$user_conversation = $twilio->conversations->v1
    ->users("UserSid")
    ->userConversations("ConversationSid")
    ->update(["notificationLevel" => "muted"]);

print $user_conversation->notificationLevel;
```

```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)

user_conversation = @client
                    .conversations
                    .v1
                    .users('UserSid')
                    .user_conversations('ConversationSid')
                    .update(notification_level: 'muted')

puts user_conversation.notification_level
```

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

twilio api:conversations:v1:users:conversations:update \
   --user-sid UserSid \
   --conversation-sid ConversationSid \
   --notification-level muted
```

```bash
curl -X POST "https://conversations.twilio.com/v1/Users/UserSid/Conversations/ConversationSid" \
--data-urlencode "NotificationLevel=muted" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "conversation_sid": "ConversationSid",
  "unread_messages_count": 100,
  "last_read_message_index": 100,
  "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "user_sid": "UserSid",
  "friendly_name": "friendly_name",
  "conversation_state": "inactive",
  "timers": {
    "date_inactive": "2015-12-16T22:19:38Z",
    "date_closed": "2015-12-16T22:28:38Z"
  },
  "attributes": "{}",
  "date_created": "2015-07-30T20:00:00Z",
  "date_updated": "2015-07-30T20:00:00Z",
  "created_by": "created_by",
  "notification_level": "muted",
  "unique_name": "unique_name",
  "url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "links": {
    "participant": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "conversation": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  }
}
```

## Remove a User from one of their Conversations

`DELETE https://conversations.twilio.com/v1/Users/{UserSid}/Conversations/{ConversationSid}`

### Path parameters

```json
[{"name":"UserSid","in":"path","description":"The unique SID identifier of the [User resource](/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.","schema":{"type":"string"},"required":true},{"name":"ConversationSid","in":"path","description":"The unique SID identifier of the Conversation. This value can be either the `sid` or the `unique_name` of the [Conversation resource](/docs/conversations/api/conversation-resource).","schema":{"type":"string"},"required":true}]
```

Remove a User from one of their Conversations

```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 deleteUserConversation() {
  await client.conversations.v1
    .users("USXXXXXXXXXXXXX")
    .userConversations("CHXXXXXXXXXXXXX")
    .remove();
}

deleteUserConversation();
```

```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)

client.conversations.v1.users("USXXXXXXXXXXXXX").user_conversations(
    "CHXXXXXXXXXXXXX"
).delete()
```

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

using System;
using Twilio;
using Twilio.Rest.Conversations.V1.User;
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);

        await UserConversationResource.DeleteAsync(
            pathUserSid: "USXXXXXXXXXXXXX", pathConversationSid: "CHXXXXXXXXXXXXX");
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.conversations.v1.user.UserConversation;

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);
        UserConversation.deleter("USXXXXXXXXXXXXX", "CHXXXXXXXXXXXXX").delete();
    }
}
```

```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()

	err := client.ConversationsV1.DeleteUserConversation("USXXXXXXXXXXXXX",
		"CHXXXXXXXXXXXXX")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}
}
```

```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);

$twilio->conversations->v1
    ->users("USXXXXXXXXXXXXX")
    ->userConversations("CHXXXXXXXXXXXXX")
    ->delete();
```

```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)

@client
  .conversations
  .v1
  .users('USXXXXXXXXXXXXX')
  .user_conversations('CHXXXXXXXXXXXXX')
  .delete
```

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

twilio api:conversations:v1:users:conversations:remove \
   --user-sid USXXXXXXXXXXXXX \
   --conversation-sid CHXXXXXXXXXXXXX
```

```bash
curl -X DELETE "https://conversations.twilio.com/v1/Users/USXXXXXXXXXXXXX/Conversations/CHXXXXXXXXXXXXX" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```
