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

Member Resource


(error)

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(link takes you to an external page).

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.


Member Properties

member-properties page anchor

Each Member resource contains these properties.

Property nameTypePIIDescription
sidSID<MB>
Not PII

The unique string that we created to identify the Member resource.

Pattern: ^MB[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>

The SID of the Account that created the Member resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

channel_sidSID<CH>

The SID of the Channel the Member resource belongs to.

Pattern: ^CH[0-9a-fA-F]{32}$Min length: 34Max length: 34

service_sidSID<IS>

The SID of the Service the Member resource is associated with.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34

identitystring
PII MTL: 30 days

The application-defined string that uniquely identifies the resource's User within the Service. See access tokens for more info.


date_createdstring<date-time>

The date and time in GMT when the resource was created specified in ISO 8601(link takes you to an external page) format.


date_updatedstring<date-time>

The date and time in GMT when the resource was last updated specified in ISO 8601(link takes you to an external page) format.


role_sidSID<RL>

The SID of the Role assigned to the member.

Pattern: ^RL[0-9a-fA-F]{32}$Min length: 34Max length: 34

last_consumed_message_indexinteger

The index of the last Message in the Channel that the Member has read.


last_consumption_timestampstring<date-time>

The ISO 8601(link takes you to an external page) timestamp of the last Message read event for the Member within the Channel.


urlstring<uri>

The absolute URL of the Member resource.


attributesstring

The JSON string that stores application-specific data. If attributes have not been set, {} is returned.


Create a Member resource

create-a-member-resource page anchor
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members

The {ChannelSid} value can be the Channel's sid or its unique_name.

Headers

headers page anchor
Property nameTypeRequiredPIIDescription
X-Twilio-Webhook-Enabledenum<string>Optional

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse
Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

The SID of the Service to create the Member resource under.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34

ChannelSidstringrequired

The SID of the Channel the new Member resource belongs to. This value can be the Channel resource's sid or unique_name.

Property nameTypeRequiredPIIDescription
Identitystringrequired

The identity value that uniquely identifies the new resource's User within the Service. See access tokens for more info.


RoleSidSID<RL>Optional

The SID of the Role to assign to the member. The default roles are those specified on the Service.

Pattern: ^RL[0-9a-fA-F]{32}$Min length: 34Max length: 34

LastConsumedMessageIndexintegerOptional

The 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.


LastConsumptionTimestampstring<date-time>Optional

The ISO 8601(link takes you to an external page) timestamp of the last Message read event for the Member within the Channel.


DateCreatedstring<date-time>Optional

The date, specified in ISO 8601(link takes you to an external page) 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.


DateUpdatedstring<date-time>Optional

The date, specified in ISO 8601(link takes you to an external page) 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.


AttributesstringOptional

A valid JSON string that contains application-specific data.

Create a Member resource

create-a-member-resource-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function createMember() {
_19
const member = await client.chat.v2
_19
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.channels("ChannelSid")
_19
.members.create({ identity: "Identity" });
_19
_19
console.log(member.sid);
_19
}
_19
_19
createMember();

Output

_14
{
_14
"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"channel_sid": "ChannelSid",
_14
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"identity": "Identity",
_14
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"last_consumed_message_index": null,
_14
"last_consumption_timestamp": null,
_14
"date_created": "2016-03-24T21:05:50Z",
_14
"date_updated": "2016-03-24T21:05:50Z",
_14
"attributes": "{}",
_14
"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.

Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

The SID of the Service to fetch the Member resource from.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34

ChannelSidstringrequired

The SID of the Channel the Member resource to fetch belongs to. This value can be the Channel resource's sid or unique_name.


Sidstringrequired

The SID of the Member resource to fetch. This value can be either the Member's sid or its identity value.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function fetchMember() {
_20
const member = await client.chat.v2
_20
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.channels("ChannelSid")
_20
.members("Sid")
_20
.fetch();
_20
_20
console.log(member.sid);
_20
}
_20
_20
fetchMember();

Output

_14
{
_14
"sid": "Sid",
_14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"channel_sid": "ChannelSid",
_14
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"identity": "jing",
_14
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"last_consumed_message_index": null,
_14
"last_consumption_timestamp": null,
_14
"date_created": "2016-03-24T21:05:50Z",
_14
"date_updated": "2016-03-24T21:05:50Z",
_14
"attributes": "{}",
_14
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_14
}


Read multiple Member resources

read-multiple-member-resources page anchor
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Members

The {ChannelSid} value can be the Channel's sid or its unique_name.

Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

The SID of the Service to read the Member resources from.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34

ChannelSidstringrequired

The SID of the Channel the Member resources to read belong to. This value can be the Channel resource's sid or unique_name.

Property nameTypeRequiredPIIDescription
Identityarray[string]Optional

The User's identity value of the Member resources to read. See access tokens for more details.


PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

Read multiple Member resources

read-multiple-member-resources-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function listMember() {
_19
const members = await client.chat.v2
_19
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.channels("ChannelSid")
_19
.members.list({ limit: 20 });
_19
_19
members.forEach((m) => console.log(m.sid));
_19
}
_19
_19
listMember();

Output

_27
{
_27
"meta": {
_27
"page": 0,
_27
"page_size": 50,
_27
"first_page_url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members?PageSize=50&Page=0",
_27
"previous_page_url": null,
_27
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members?PageSize=50&Page=0",
_27
"next_page_url": null,
_27
"key": "members"
_27
},
_27
"members": [
_27
{
_27
"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"identity": "jing",
_27
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_27
"last_consumed_message_index": null,
_27
"last_consumption_timestamp": null,
_27
"date_created": "2016-03-24T21:05:50Z",
_27
"date_updated": "2016-03-24T21:05:50Z",
_27
"attributes": "{}",
_27
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_27
}
_27
]
_27
}


Update a Member resource

update-a-member-resource page anchor
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.

Property nameTypeRequiredPIIDescription
X-Twilio-Webhook-Enabledenum<string>Optional

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse
Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

The SID of the Service to update the Member resource in.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34

ChannelSidstringrequired

The SID of the Channel the Member resource to update belongs to. This value can be the Channel resource's sid or unique_name.


Sidstringrequired

The SID of the Member resource to update. This value can be either the Member's sid or its identity value.

Property nameTypeRequiredPIIDescription
RoleSidSID<RL>Optional

The SID of the Role to assign to the member. The default roles are those specified on the Service.

Pattern: ^RL[0-9a-fA-F]{32}$Min length: 34Max length: 34

LastConsumedMessageIndexintegerOptional

The index of the last Message that the Member has read within the Channel.


LastConsumptionTimestampstring<date-time>Optional

The ISO 8601(link takes you to an external page) timestamp of the last Message read event for the Member within the Channel.


DateCreatedstring<date-time>Optional

The date, specified in ISO 8601(link takes you to an external page) 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.


DateUpdatedstring<date-time>Optional

The date, specified in ISO 8601(link takes you to an external page) format, to assign to the resource as the date it was last updated.


AttributesstringOptional

A valid JSON string that contains application-specific data.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_20
// Download the helper library from https://www.twilio.com/docs/node/install
_20
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20
_20
// Find your Account SID and Auth Token at twilio.com/console
_20
// and set the environment variables. See http://twil.io/secure
_20
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20
const authToken = process.env.TWILIO_AUTH_TOKEN;
_20
const client = twilio(accountSid, authToken);
_20
_20
async function updateMember() {
_20
const member = await client.chat.v2
_20
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.channels("ChannelSid")
_20
.members("Sid")
_20
.update({ roleSid: "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" });
_20
_20
console.log(member.sid);
_20
}
_20
_20
updateMember();

Output

_14
{
_14
"sid": "Sid",
_14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"channel_sid": "ChannelSid",
_14
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"identity": "jing",
_14
"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"last_consumed_message_index": 20,
_14
"last_consumption_timestamp": "2016-03-24T21:05:52Z",
_14
"date_created": "2016-03-24T21:05:50Z",
_14
"date_updated": "2016-03-24T21:05:51Z",
_14
"attributes": "{}",
_14
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_14
}


Delete a Member resource

delete-a-member-resource page anchor
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.

Property nameTypeRequiredPIIDescription
X-Twilio-Webhook-Enabledenum<string>Optional

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse
Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

The SID of the Service to delete the Member resource from.

Pattern: ^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34

ChannelSidstringrequired

The SID of the Channel the Member resource to delete belongs to. This value can be the Channel resource's sid or unique_name.


Sidstringrequired

The SID of the Member resource to delete. This value can be either the Member's sid or its identity value.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function deleteMember() {
_18
await client.chat.v2
_18
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.channels("ChannelSid")
_18
.members("Sid")
_18
.remove();
_18
}
_18
_18
deleteMember();


Rate this page: