Member Resource
Danger
Programmable Chat has been deprecated and is no longer supported. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here.
If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.
A Member resource of Programmable Chat represents the membership of a User to a Channel within a Service instance.
We recommend following the standard URI specification and avoid the following reserved characters ! * ' ( ) ; : @ & = + $ , / ? % # [ ] for values such as identity and friendly name.
Each Member resource contains these properties.
The unique string that we created to identify the Member resource.
^MB[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Account that created the Member resource.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Channel the Member resource belongs to.
^CH[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Service the Member resource is associated with.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The application-defined string that uniquely identifies the resource's User within the Service. See access tokens for more info.
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.
The SID of the Role assigned to the member.
^RL[0-9a-fA-F]{32}$Min length: 34Max length: 34The JSON string that stores application-specific data. If attributes have not been set, {} is returned.
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members
The {ChannelSid} value can be the Channel's sid or its unique_name.
The X-Twilio-Webhook-Enabled HTTP request header
truefalseThe SID of the Service to create the Member resource under.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34application/x-www-form-urlencodedThe identity value that uniquely identifies the new resource's User within the Service. See access tokens for more info.
The SID of the Role to assign to the member. The default roles are those specified on the Service.
^RL[0-9a-fA-F]{32}$Min length: 34Max length: 34The index of the last Message in the Channel that the Member has read. This parameter should only be used when recreating a Member from a backup/separate source.
The date, specified in ISO 8601 format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source.
The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated. The default value is null. Note that this parameter should only be used when a Member is being recreated from a backup/separate source and where a Member was previously updated.
A valid JSON string that contains application-specific data.
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 createMember() {11const member = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.channels("ChannelSid")14.members.create({ identity: "Identity" });1516console.log(member.sid);17}1819createMember();
Response
1{2"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"channel_sid": "ChannelSid",5"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "Identity",7"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"last_consumed_message_index": null,9"last_consumption_timestamp": null,10"date_created": "2016-03-24T21:05:50Z",11"date_updated": "2016-03-24T21:05:50Z",12"attributes": "{}",13"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"14}
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}
The {ChannelSid} value can be the Channel's sid or its unique_nameand the {Sid} value can be either the sid or the identity of the Member resource to fetch.
The SID of the Service to fetch the Member resource from.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Channel the Member resource to fetch belongs to. This value can be the Channel resource's sid or unique_name.
The SID of the Member resource to fetch. This value can be either the Member's sid or its identity value.
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 fetchMember() {11const member = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.channels("ChannelSid")14.members("Sid")15.fetch();1617console.log(member.sid);18}1920fetchMember();
Response
1{2"sid": "Sid",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"channel_sid": "ChannelSid",5"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "jing",7"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"last_consumed_message_index": null,9"last_consumption_timestamp": null,10"date_created": "2016-03-24T21:05:50Z",11"date_updated": "2016-03-24T21:05:50Z",12"attributes": "{}",13"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"14}
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members
The {ChannelSid} value can be the Channel's sid or its unique_name.
The SID of the Service to read the Member resources from.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The User's identity value of the Member resources to read. See access tokens for more details.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1Maximum: 1000The 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 listMember() {11const members = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.channels("ChannelSid")14.members.list({ limit: 20 });1516members.forEach((m) => console.log(m.sid));17}1819listMember();
Response
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members?PageSize=50&Page=0",6"previous_page_url": null,7"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members?PageSize=50&Page=0",8"next_page_url": null,9"key": "members"10},11"members": [12{13"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"identity": "jing",18"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",19"last_consumed_message_index": null,20"last_consumption_timestamp": null,21"date_created": "2016-03-24T21:05:50Z",22"date_updated": "2016-03-24T21:05:50Z",23"attributes": "{}",24"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"25}26]27}
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}
The {Sid} value can be either the sid or the identity of the Member resource to update and the {ChannelSid} value can be the Channel's sid or its unique_name.
The X-Twilio-Webhook-Enabled HTTP request header
truefalseThe SID of the Service to update the Member resource in.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Channel the Member resource to update belongs to. This value can be the Channel resource's sid or unique_name.
The SID of the Member resource to update. This value can be either the Member's sid or its identity value.
application/x-www-form-urlencodedThe SID of the Role to assign to the member. The default roles are those specified on the Service.
^RL[0-9a-fA-F]{32}$Min length: 34Max length: 34The date, specified in ISO 8601 format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. Note that this parameter should only be used when a Member is being recreated from a backup/separate source.
The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated.
A valid JSON string that contains application-specific data.
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 updateMember() {11const member = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.channels("ChannelSid")14.members("Sid")15.update({ roleSid: "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" });1617console.log(member.sid);18}1920updateMember();
Response
1{2"sid": "Sid",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"channel_sid": "ChannelSid",5"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",6"identity": "jing",7"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"last_consumed_message_index": 20,9"last_consumption_timestamp": "2016-03-24T21:05:52Z",10"date_created": "2016-03-24T21:05:50Z",11"date_updated": "2016-03-24T21:05:51Z",12"attributes": "{}",13"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"14}
DELETE https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members/{Sid}
The {Sid} value can be either the sid or the identity of the Member resource to delete and the {ChannelSid} value can be the Channel's sid or its unique_name.
The X-Twilio-Webhook-Enabled HTTP request header
truefalseThe SID of the Service to delete the Member resource from.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Channel the Member resource to delete belongs to. This value can be the Channel resource's sid or unique_name.
The SID of the Member resource to delete. This value can be either the Member's sid or its identity value.
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 deleteMember() {11await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.channels("ChannelSid")14.members("Sid")15.remove();16}1718deleteMember();