In Conversations, Users are Participants with privileges such as the ability to edit and delete Messages.
Every Conversation Participant who connects with a Chat SDK (browser or mobile) is backed by a User. Participants over SMS or other non-chat channel, in contrast, do not have a corresponding User. Attached to the User is:
We recommend following the standard URI specification and avoid the following reserved characters ! * ' ( ) ; : @ & = + $ , / ? % # [ ]
for values such as identity and friendly name.
All URLs in the reference documentation use the following base URL:
1https://conversations.twilio.com/v12
Using the REST API, you can interact with User resources in the default Conversation Service instance via a "shortened" URL that does not include the Conversation Service instance SID ("ISXXX..."). If you are only using one Conversation Service (the default), you do not need to include the Conversation Service SID in your URL, e.g.
1GET /v1/Users/2
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:
GET /v1/Services/<Service SID, ISXXX...>/Users/
The unique string that we created to identify the User resource.
^US[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the User resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Conversation Service the User resource is associated with.
^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of a service-level Role assigned to the user.
^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The application-defined string that uniquely identifies the resource's User within the Conversation Service. This value is often a username or an email address, and is case-sensitive.
The JSON Object string that stores application-specific data. If attributes have not been set, {}
is returned.
Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and null
is always returned by a Read action. This value is null
if the Service's reachability_enabled
is false
, if the User has never been online for this Conversations Service, even if the Service's reachability_enabled
is true
.
Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, true
; otherwise false
. This value is only returned by Fetch actions that return a single resource and null
is always returned by a Read action. This value is null
if the Service's reachability_enabled
is false
, and if the User has never had a notification registration, even if the Service's reachability_enabled
is true
.
The date and time in GMT when the resource was created specified in ISO 8601 format.
The date and time in GMT when the resource was last updated specified in ISO 8601 format.
POST https://conversations.twilio.com/v1/Users
The X-Twilio-Webhook-Enabled HTTP request header
true
false
application/x-www-form-urlencoded
The application-defined string that uniquely identifies the resource's User within the Conversation Service. This value is often a username or an email address, and is case-sensitive.
The JSON Object string that stores application-specific data. If attributes have not been set, {}
is returned.
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 createUser() {11const user = await client.conversations.v1.users.create({12identity: "RedgrenGrumbholdt",13});1415console.log(user.sid);16}1718createUser();
1{2"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "RedgrenGrumbholdt",7"friendly_name": "name",8"attributes": "{ \"duty\": \"tech\" }",9"is_online": true,10"is_notifiable": null,11"date_created": "2019-12-16T22:18:37Z",12"date_updated": "2019-12-16T22:18:38Z",13"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"links": {15"user_conversations": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations"16}17}
GET https://conversations.twilio.com/v1/Users/{Sid}
The SID of the User resource to fetch. This value can be either the sid
or the identity
of the User resource to fetch.
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 fetchUser() {11const user = await client.conversations.v1.users("Sid").fetch();1213console.log(user.sid);14}1516fetchUser();
1{2"sid": "Sid",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "admin",7"friendly_name": "name",8"attributes": "{ \"duty\": \"tech\" }",9"is_online": true,10"is_notifiable": null,11"date_created": "2019-12-16T22:18:37Z",12"date_updated": "2019-12-16T22:18:38Z",13"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"links": {15"user_conversations": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations"16}17}
GET https://conversations.twilio.com/v1/Users
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
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 listUser() {11const users = await client.conversations.v1.users.list({ limit: 20 });1213users.forEach((u) => console.log(u.sid));14}1516listUser();
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://conversations.twilio.com/v1/Users?PageSize=50&Page=0",6"previous_page_url": null,7"url": "https://conversations.twilio.com/v1/Users?PageSize=50&Page=0",8"next_page_url": null,9"key": "users"10},11"users": [12{13"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"identity": "admin",18"friendly_name": "name",19"attributes": "{ \"duty\": \"tech\" }",20"is_online": true,21"is_notifiable": null,22"date_created": "2019-12-16T22:18:37Z",23"date_updated": "2019-12-16T22:18:38Z",24"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",25"links": {26"user_conversations": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations"27}28},29{30"sid": "USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",31"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",32"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",33"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",34"identity": "agent0034",35"friendly_name": "John from customs",36"attributes": "{ \"duty\": \"agent\" }",37"is_online": false,38"is_notifiable": null,39"date_created": "2020-03-24T20:38:21Z",40"date_updated": "2020-03-24T20:38:21Z",41"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",42"links": {43"user_conversations": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations"44}45}46]47}
POST https://conversations.twilio.com/v1/Users/{Sid}
The X-Twilio-Webhook-Enabled HTTP request header
true
false
The SID of the User resource to update. This value can be either the sid
or the identity
of the User resource to update.
application/x-www-form-urlencoded
The JSON Object string that stores application-specific data. If attributes have not been set, {}
is returned.
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 updateUser() {11const user = await client.conversations.v1.users("Sid").update({12friendlyName: "new name",13roleSid: "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",14});1516console.log(user.sid);17}1819updateUser();
1{2"sid": "Sid",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"role_sid": "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",6"identity": "admin",7"friendly_name": "new name",8"attributes": "{ \"duty\": \"tech\", \"team\": \"internals\" }",9"is_online": true,10"is_notifiable": null,11"date_created": "2019-12-16T22:18:37Z",12"date_updated": "2019-12-16T22:18:38Z",13"url": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"links": {15"user_conversations": "https://conversations.twilio.com/v1/Users/USaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations"16}17}
DELETE https://conversations.twilio.com/v1/Users/{Sid}
The X-Twilio-Webhook-Enabled HTTP request header
true
false
The SID of the User resource to delete. This value can be either the sid
or the identity
of the User resource to delete.
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 deleteUser() {11await client.conversations.v1.users("Sid").remove();12}1314deleteUser();