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.

Property nameTypePIIDescription
sidSID<IN>
Not PII

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

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

account_sidSID<AC>

The SID of the Account that created the Invite resource.

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

channel_sidSID<CH>

The SID of the Channel the Invite resource belongs to.

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

service_sidSID<IS>

The SID of the Service the Invite 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 resource.

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

created_bystring

The identity of the User that created the invite.


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

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

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

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

ChannelSidstringrequired

The SID of the Channel the new Invite 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 assigned to the new member.

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

Create an Invite resource

create-an-invite-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 createInvite() {
_19
const invite = await client.chat.v2
_19
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.channels("ChannelSid")
_19
.invites.create({ identity: "Identity" });
_19
_19
console.log(invite.sid);
_19
}
_19
_19
createInvite();

Output

_12
{
_12
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"channel_sid": "ChannelSid",
_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": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"sid": "INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites/INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_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.

Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

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

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

ChannelSidstringrequired

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


SidSID<IN>required

The SID of the Invite resource to fetch.

Pattern: ^IN[0-9a-fA-F]{32}$Min length: 34Max length: 34
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 fetchInvite() {
_20
const invite = await client.chat.v2
_20
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.channels("ChannelSid")
_20
.invites("INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20
.fetch();
_20
_20
console.log(invite.sid);
_20
}
_20
_20
fetchInvite();

Output

_12
{
_12
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"channel_sid": "ChannelSid",
_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": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"sid": "INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_12
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites/INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
_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.

Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

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

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

ChannelSidstringrequired

The SID of the Channel the Invite 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 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 Invite resources

read-multiple-invite-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 listInvite() {
_19
const invites = await client.chat.v2
_19
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.channels("ChannelSid")
_19
.invites.list({ limit: 20 });
_19
_19
invites.forEach((i) => console.log(i.sid));
_19
}
_19
_19
listInvite();

Output

_12
{
_12
"invites": [],
_12
"meta": {
_12
"first_page_url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites?Identity=identity&PageSize=50&Page=0",
_12
"key": "invites",
_12
"next_page_url": null,
_12
"page": 0,
_12
"page_size": 50,
_12
"previous_page_url": null,
_12
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites?Identity=identity&PageSize=50&Page=0"
_12
}
_12
}


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.

Property nameTypeRequiredPIIDescription
ServiceSidSID<IS>required

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

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

ChannelSidstringrequired

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


SidSID<IN>required

The SID of the Invite resource to delete.

Pattern: ^IN[0-9a-fA-F]{32}$Min length: 34Max length: 34
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 deleteInvite() {
_18
await client.chat.v2
_18
.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.channels("ChannelSid")
_18
.invites("INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.remove();
_18
}
_18
_18
deleteInvite();


Rate this page: