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.

Resource properties
sidtype: SID<MB>Not PII

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


account_sidtype: SID<AC>Not PII

The SID of the Account(link takes you to an external page) that created the Member resource.


channel_sidtype: SID<CH>Not PII

The SID of the Channel(link takes you to an external page) the Member resource belongs to.


service_sidtype: SID<IS>Not PII

The SID of the Service(link takes you to an external page) the Member resource is associated with.


identitytype: stringPII MTL: 30 days

The application-defined string that uniquely identifies the resource's User(link takes you to an external page) within the Service(link takes you to an external page). See access tokens(link takes you to an external page) for more info.


date_createdtype: string<DATE TIME>Not PII

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


date_updatedtype: string<DATE TIME>Not PII

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_sidtype: SID<RL>Not PII

The SID of the Role(link takes you to an external page) assigned to the member.


last_consumed_message_indextype: integerNot PII

last_consumption_timestamptype: string<DATE TIME>Not PII

urltype: string<URI>Not PII

The absolute URL of the Member resource.


attributestype: stringPII MTL: 30 days

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.

Parameters

create-parameters page anchor
Request headers
X-Twilio-Webhook-Enabledtype: enum<STRING>Not PII

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) to create the Member resource under.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the new Member resource belongs to. This value can be the Channel resource's sid or unique_name.


Request body parameters
Identitytype: stringPII MTL: 30 days
Required

The identity value that uniquely identifies the new resource's User(link takes you to an external page) within the Service(link takes you to an external page). See access tokens(link takes you to an external page) for more info.


RoleSidtype: SID<RL>Not PII

The SID of the Role(link takes you to an external page) to assign to the member. The default roles are those specified on the Service(link takes you to an external page).


LastConsumedMessageIndextype: integerNot PII

The index of the last Message(link takes you to an external page) in the Channel(link takes you to an external page) that the Member has read. This parameter should only be used when recreating a Member from a backup/separate source.


LastConsumptionTimestamptype: string<DATE TIME>Not PII

DateCreatedtype: string<DATE TIME>Not PII

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.


DateUpdatedtype: string<DATE TIME>Not PII

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.


Attributestype: stringPII MTL: 30 days

A valid JSON string that contains application-specific data.

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

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.members
_12
.create({identity: 'identity'})
_12
.then(member => console.log(member.sid));

Output

_14
{
_14
"sid": "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"identity": "jing",
_14
"role_sid": "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_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.

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) to fetch the Member resource from.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the Member resource to fetch belongs to. This value can be the Channel resource's sid or unique_name.


Sidtype: stringNot PII
Path Parameter

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

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.members('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.fetch()
_12
.then(member => console.log(member.sid));

Output

_14
{
_14
"sid": "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"identity": "jing",
_14
"role_sid": "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_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.

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) to read the Member resources from.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the Member resources to read belong to. This value can be the Channel resource's sid or unique_name.


Identitytype: string[]PII MTL: 30 days
Query Parameter

The User(link takes you to an external page)'s identity value of the Member resources to read. See access tokens(link takes you to an external page) for more details.


PageSizetype: integerNot PII
Query Parameter

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


Pagetype: integerNot PII
Query Parameter

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


PageTokentype: stringNot PII
Query Parameter

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

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.members
_12
.list({limit: 20})
_12
.then(members => members.forEach(m => console.log(m.sid)));

Output

_27
{
_27
"meta": {
_27
"page": 0,
_27
"page_size": 50,
_27
"first_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members?PageSize=50&Page=0",
_27
"previous_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members?PageSize=50&Page=0",
_27
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members?PageSize=50&Page=0",
_27
"next_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members?PageSize=50&Page=1",
_27
"key": "members"
_27
},
_27
"members": [
_27
{
_27
"sid": "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_27
"identity": "jing",
_27
"role_sid": "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_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.

Request headers
X-Twilio-Webhook-Enabledtype: enum<STRING>Not PII

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) to update the Member resource in.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the Member resource to update belongs to. This value can be the Channel resource's sid or unique_name.


Sidtype: stringNot PII
Path Parameter

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


Request body parameters
RoleSidtype: SID<RL>Not PII

The SID of the Role(link takes you to an external page) to assign to the member. The default roles are those specified on the Service(link takes you to an external page).


LastConsumedMessageIndextype: integerNot PII

The index of the last Message(link takes you to an external page) that the Member has read within the Channel(link takes you to an external page).


LastConsumptionTimestamptype: string<DATE TIME>Not PII

DateCreatedtype: string<DATE TIME>Not PII

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.


DateUpdatedtype: string<DATE TIME>Not PII

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.


Attributestype: stringPII MTL: 30 days

A valid JSON string that contains application-specific data.

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

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.members('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.update({roleSid: 'RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'})
_12
.then(member => console.log(member.sid));

Output

_14
{
_14
"sid": "MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_14
"identity": "jing",
_14
"role_sid": "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members/MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_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.

Request headers
X-Twilio-Webhook-Enabledtype: enum<STRING>Not PII

The X-Twilio-Webhook-Enabled HTTP request header

Possible values:
truefalse

URI parameters
ServiceSidtype: SID<IS>Not PII
Path Parameter

The SID of the Service(link takes you to an external page) to delete the Member resource from.


ChannelSidtype: stringNot PII
Path Parameter

The SID of the Channel(link takes you to an external page) the Member resource to delete belongs to. This value can be the Channel resource's sid or unique_name.


Sidtype: stringNot PII
Path Parameter

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

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.chat.v2.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.channels('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.members('MBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.remove();


Rate this page: