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

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

An Invite resource for Programmable Chat represents an invitation for a User (within the Service instance) to join a Channel and become a Member.


Invite Properties

invite-properties page anchor

Each Invite resource contains these properties.

Resource properties
sidtype: SID<IN>
Not PII

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


account_sidtype: SID<AC>

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


channel_sidtype: SID<CH>

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


service_sidtype: SID<IS>

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


identitytype: string

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>

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>

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>

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


created_bytype: string

The identity of the User that created the invite.


urltype: string<uri>

The absolute URL of the Invite resource.


Create an Invite resource

create-an-invite-resource page anchor
POST https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites

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

Parameters

create-parameters page anchor
URI parameters
ServiceSidtype: SID<IS>
Path ParameterNot PII

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


ChannelSidtype: string
Path ParameterNot PII

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


Request body parameters
Identitytype: stringRequired

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>

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

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
.invites
_12
.create({identity: 'identity'})
_12
.then(invite => console.log(invite.sid));

Output

_12
{
_12
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"created_by": "created_by",
_12
"date_created": "2015-07-30T20:00:00Z",
_12
"date_updated": "2015-07-30T20:00:00Z",
_12
"identity": "identity",
_12
"role_sid": "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"sid": "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites/INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_12
}


Fetch an Invite resource

fetch-an-invite-resource page anchor
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}

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

URI parameters
ServiceSidtype: SID<IS>
Path ParameterNot PII

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


ChannelSidtype: string
Path ParameterNot PII

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


Sidtype: SID<IN>
Path ParameterNot PII

The SID of the Invite resource to fetch.

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
.invites('INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.fetch()
_12
.then(invite => console.log(invite.sid));

Output

_12
{
_12
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"created_by": "created_by",
_12
"date_created": "2015-07-30T20:00:00Z",
_12
"date_updated": "2015-07-30T20:00:00Z",
_12
"identity": "identity",
_12
"role_sid": "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"sid": "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites/INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_12
}


Read multiple Invite resources

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

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

URI parameters
ServiceSidtype: SID<IS>
Path ParameterNot PII

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


ChannelSidtype: string
Path ParameterNot PII

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


Identitytype: array[string]
Query ParameterPII MTL: 30 days

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


PageSizetype: integer
Query ParameterNot PII

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


Pagetype: integer
Query ParameterNot PII

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


PageTokentype: string
Query ParameterNot PII

The page token. This is provided by the API.

Read multiple Invite resources

read-multiple-invite-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
.invites
_12
.list({limit: 20})
_12
.then(invites => invites.forEach(i => console.log(i.sid)));

Output

_25
{
_25
"invites": [
_25
{
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"channel_sid": "CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"created_by": "created_by",
_25
"date_created": "2015-07-30T20:00:00Z",
_25
"date_updated": "2015-07-30T20:00:00Z",
_25
"identity": "identity",
_25
"role_sid": "RLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"sid": "INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites/INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_25
}
_25
],
_25
"meta": {
_25
"first_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites?Identity=identity&PageSize=50&Page=0",
_25
"key": "invites",
_25
"next_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites?Identity=identity&PageSize=50&Page=1",
_25
"page": 0,
_25
"page_size": 50,
_25
"previous_page_url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites?Identity=identity&PageSize=50&Page=0",
_25
"url": "https://chat.twilio.com/v2/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Channels/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Invites?Identity=identity&PageSize=50&Page=0"
_25
}
_25
}


Delete an Invite resource

delete-an-invite-resource page anchor
DELETE https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites/{Sid}

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

URI parameters
ServiceSidtype: SID<IS>
Path ParameterNot PII

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


ChannelSidtype: string
Path ParameterNot PII

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


Sidtype: SID<IN>
Path ParameterNot PII

The SID of the Invite resource to delete.

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
.invites('INXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.remove();


Rate this page: