Invite Resource
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.
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.
Each Invite resource contains these properties.
The unique string that we created to identify the Invite resource.
^IN[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Account that created the Invite resource.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Channel the Invite resource belongs to.
^CH[0-9a-fA-F]{32}$Min length: 34Max length: 34The SID of the Service the Invite resource is associated with.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The application-defined string that uniquely identifies the resource's User within the Service. See access tokens for more info.
The date and time in GMT when the resource was created specified in ISO 8601 format.
The date and time in GMT when the resource was last updated specified in ISO 8601 format.
The SID of the Role assigned to the resource.
^RL[0-9a-fA-F]{32}$Min length: 34Max length: 34The 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.
The SID of the Service to create the Invite resource under.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34application/x-www-form-urlencodedThe identity value that uniquely identifies the new resource's User within the Service. See access tokens for more info.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createInvite() {11const invite = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.channels("ChannelSid")14.invites.create({ identity: "Identity" });1516console.log(invite.sid);17}1819createInvite();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"channel_sid": "ChannelSid",4"created_by": "created_by",5"date_created": "2015-07-30T20:00:00Z",6"date_updated": "2015-07-30T20:00:00Z",7"identity": "Identity",8"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10"sid": "INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",11"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites/INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"12}
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.
The SID of the Service to fetch the Invite resource from.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The 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.
^IN[0-9a-fA-F]{32}$Min length: 34Max length: 341// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchInvite() {11const invite = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.channels("ChannelSid")14.invites("INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.fetch();1617console.log(invite.sid);18}1920fetchInvite();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"channel_sid": "ChannelSid",4"created_by": "created_by",5"date_created": "2015-07-30T20:00:00Z",6"date_updated": "2015-07-30T20:00:00Z",7"identity": "identity",8"role_sid": "RLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",9"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10"sid": "INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",11"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites/INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"12}
GET https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Invites
The {ChannelSid} value can be the Channel's sid or its unique_name.
The SID of the Service to read the Invite resources from.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The 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.
1Maximum: 1000The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listInvite() {11const invites = await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.channels("ChannelSid")14.invites.list({ limit: 20 });1516invites.forEach((i) => console.log(i.sid));17}1819listInvite();
Response
1{2"invites": [],3"meta": {4"first_page_url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites?Identity=identity&PageSize=50&Page=0",5"key": "invites",6"next_page_url": null,7"page": 0,8"page_size": 50,9"previous_page_url": null,10"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Invites?Identity=identity&PageSize=50&Page=0"11}12}
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.
The SID of the Service to delete the Invite resource from.
^IS[0-9a-fA-F]{32}$Min length: 34Max length: 34The 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.
^IN[0-9a-fA-F]{32}$Min length: 34Max length: 341// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteInvite() {11await client.chat.v212.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.channels("ChannelSid")14.invites("INaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")15.remove();16}1718deleteInvite();