Invite Resource
An Invite resource for Programmable Chat represents an invitation for a User (within the Service instance) to join a Channel and become a Member.
Each Invite resource contains these properties.
Property nameTypePIIDescription
The unique string that we created to identify the Invite resource.
Pattern: ^IN[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the Invite resource.
Pattern: ^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Channel the Invite resource belongs to.
Pattern: ^CH[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Service the Invite resource is associated with.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The application-defined string that uniquely identifies the resource's User within the Service. See access tokens for more info.
date_createdstring<date-time>
date_updatedstring<date-time>
The SID of the Role assigned to the resource.
Pattern: ^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The identity
of the User that created the invite.
The absolute URL of the Invite resource.
POST 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 create the Invite resource under.
Pattern: ^IS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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
The identity
value that uniquely identifies the new resource's User within the Service. See access tokens for more info.
The SID of the Role assigned to the new member.
Pattern: ^RL[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
_19// Download the helper library from https://www.twilio.com/docs/node/install
_19const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19// Find your Account SID and Auth Token at twilio.com/console
_19// and set the environment variables. See http://twil.io/secure
_19const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19const authToken = process.env.TWILIO_AUTH_TOKEN;
_19const client = twilio(accountSid, authToken);
_19async function createInvite() {
_19 const invite = await client.chat.v2
_19 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 .channels("ChannelSid")
_19 .invites.create({ identity: "Identity" });
_19 console.log(invite.sid);
_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"
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: 34
Max length: 34
The SID of the Channel the Invite resource to fetch belongs to. This value can be the Channel resource's sid
or unique_name
.
The SID of the Invite resource to fetch.
Pattern: ^IN[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
_20// Download the helper library from https://www.twilio.com/docs/node/install
_20const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_20// Find your Account SID and Auth Token at twilio.com/console
_20// and set the environment variables. See http://twil.io/secure
_20const accountSid = process.env.TWILIO_ACCOUNT_SID;
_20const authToken = process.env.TWILIO_AUTH_TOKEN;
_20const client = twilio(accountSid, authToken);
_20async function fetchInvite() {
_20 const invite = await client.chat.v2
_20 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20 .channels("ChannelSid")
_20 .invites("INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_20 console.log(invite.sid);
_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"
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: 34
Max length: 34
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.
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Minimum: 1
Maximum: 1000
The page index. This value is simply for client state.
Minimum: 0
The page token. This is provided by the API.
_19// Download the helper library from https://www.twilio.com/docs/node/install
_19const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19// Find your Account SID and Auth Token at twilio.com/console
_19// and set the environment variables. See http://twil.io/secure
_19const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19const authToken = process.env.TWILIO_AUTH_TOKEN;
_19const client = twilio(accountSid, authToken);
_19async function listInvite() {
_19 const invites = await client.chat.v2
_19 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19 .channels("ChannelSid")
_19 .invites.list({ limit: 20 });
_19 invites.forEach((i) => console.log(i.sid));
_12 "first_page_url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites?Identity=identity&PageSize=50&Page=0",
_12 "next_page_url": null,
_12 "previous_page_url": null,
_12 "url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites?Identity=identity&PageSize=50&Page=0"
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: 34
Max length: 34
The SID of the Channel the Invite resource to delete belongs to. This value can be the Channel resource's sid
or unique_name
.
The SID of the Invite resource to delete.
Pattern: ^IN[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
_18// Download the helper library from https://www.twilio.com/docs/node/install
_18const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18// Find your Account SID and Auth Token at twilio.com/console
_18// and set the environment variables. See http://twil.io/secure
_18const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18const authToken = process.env.TWILIO_AUTH_TOKEN;
_18const client = twilio(accountSid, authToken);
_18async function deleteInvite() {
_18 .services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18 .channels("ChannelSid")
_18 .invites("INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")