typescript
Resources

API and SDK reference

Installation
TypeScript

NPM


_10
npm add Twilio-Communications-API

Yarn


_10
yarn add Twilio-Communications-API


Custom HTTP Client
TypeScript

The TypeScript SDK makes API calls using an HTTPClient that wraps the native Fetch API. This client is a thin wrapper around fetch and provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle errors and response.

The HTTPClient constructor takes an optional fetcher argument that can be used to integrate a third-party HTTP client or when writing tests to mock out the HTTP client and feed in fixtures.

The following example shows how to use the "beforeRequest" hook to to add a custom header and a timeout to requests and how to use the "requestError" hook to log errors:


_28
import { TwillioSDKDocs } from "Twilio-Communications-API";
_28
import { HTTPClient } from "Twilio-Communications-API/lib/http";
_28
_28
const httpClient = new HTTPClient({
_28
// fetcher takes a function that has the same signature as native `fetch`.
_28
fetcher: (request) => {
_28
return fetch(request);
_28
}
_28
});
_28
_28
httpClient.addHook("beforeRequest", (request) => {
_28
const nextRequest = new Request(request, {
_28
signal: request.signal || AbortSignal.timeout(5000);
_28
});
_28
_28
nextRequest.headers.set("x-custom-header", "custom value");
_28
_28
return nextRequest;
_28
});
_28
_28
httpClient.addHook("requestError", (error, request) => {
_28
console.group("Request Error");
_28
console.log("Reason:", `${error}`);
_28
console.log("Endpoint:", `${request.method} ${request.url}`);
_28
console.groupEnd();
_28
});
_28
_28
const sdk = new TwillioSDKDocs({ httpClient });


Security Options
TypeScript

Per-Client Security Schemes

This SDK supports the following security scheme globally:

You can set the security parameters through the security optional parameter when initializing the SDK client instance. For example:


_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const result = await sdk.addressLookups.createAddressLookups({
_19
addresses: [,],
_19
});
_19
_19
// Handle the result
_19
console.log(result);
_19
}
_19
_19
run();


Errors
TypeScript

All SDK methods return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.

Example


_33
import { TwillioSDKDocs } from "Twilio-Communications-API";
_33
import * as errors from "Twilio-Communications-API/models/errors";
_33
_33
async function run() {
_33
const sdk = new TwillioSDKDocs({
_33
security: {
_33
username: "<YOUR_USERNAME_HERE>",
_33
password: "<YOUR_PASSWORD_HERE>",
_33
},
_33
});
_33
_33
let result;
_33
try {
_33
result = await sdk.addressLookups.createAddressLookups({
_33
addresses: [,],
_33
});
_33
} catch (err) {
_33
switch (true) {
_33
case err instanceof errors.TwilioError: {
_33
console.error(err); // handle exception
_33
return;
_33
}
_33
default: {
_33
throw err;
_33
}
_33
}
_33
}
_33
_33
// Handle the result
_33
console.log(result);
_33
}
_33
_33
run();


Server Options
TypeScript

Select Server by Index

You can override the default server globally by passing a server index to the serverIdx optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:


_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
serverIdx: 0,
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const result = await sdk.addressLookups.createAddressLookups({
_20
addresses: [,],
_20
});
_20
_20
// Handle the result
_20
console.log(result);
_20
}
_20
_20
run();

Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the serverURL optional parameter when initializing the SDK client instance. For example:


_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
serverURL: "https://comms.twilio.com/preview",
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const result = await sdk.addressLookups.createAddressLookups({
_20
addresses: [,],
_20
});
_20
_20
// Handle the result
_20
console.log(result);
_20
}
_20
_20
run();


Address Lookups

*Use AddressLookups to validate your phone numbers and email addresses and get back a detailed report on their validity and the identity of the people behind them.*

Available Operations


Address Lookups

Create Address Lookups

This operation creates AddressLookups

Parameters

TypeScript
request: operations.CreateAddressLookupsCreateAddressLookups

The request object to use for the request.

Show child properties
addresses: *operations.AddressLookupInput*[]

A list of communications addresses to fetch additional information for.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateAddressLookupsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


createAddressLookupsResponse?: operations.CreateAddressLookupsCreateAddressLookupsResponse

Created

Show child properties

headers: Record<string, *string*[]>
CreateAddressLookups.ts

_21
import { TwillioSDKDocs } from "Twilio-Communications-API";
_21
_21
async function run() {
_21
const sdk = new TwillioSDKDocs({
_21
security: {
_21
username: "<YOUR_USERNAME_HERE>",
_21
password: "<YOUR_PASSWORD_HERE>",
_21
},
_21
});
_21
_21
const result = await sdk.addressLookups.createAddressLookups({
_21
addresses: [
_21
,
_21
],
_21
});
_21
_21
// Handle the result
_21
console.log(result)
_21
}
_21
_21
run();

Example Response

_28
{
_28
"address_lookups": [
_28
{
_28
"id": "addresslookup_01h9krwprkeee8fzqspvwy6nq8",
_28
"type": "phone_number",
_28
"address": "string",
_28
"calling_country_code": "string",
_28
"country_code": "string",
_28
"phone_number": "string",
_28
"national_format": "string",
_28
"valid": false,
_28
"validation_errors": [],
_28
"caller_name": {},
_28
"sim_swap": {},
_28
"call_forwarding": {},
_28
"live_activity": {},
_28
"line_type_intelligence": {},
_28
"identity_match": {},
_28
"reassigned_number": {},
_28
"sms_pumping_risk": {},
_28
"disposable_phone_number_risk": {},
_28
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_28
"operation_id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_28
"created_at": "2024-07-14T07:33:58.078Z",
_28
"updated_at": "2023-10-23T15:05:15.700Z"
_28
}
_28
]
_28
}


Address Lookups

List Address Lookups

This operation fetches a paginated list of AddressLookups.

Parameters

TypeScript
address?: string

Filter AddressLookups by address.


startDate?: Date

Filter to AddressLookups created after the specified date and time.


endDate?: Date

Filter to AddressLookups created before the specified date and time.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListAddressLookupsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listAddressLookupsResponse?: operations.ListAddressLookupsListAddressLookupsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListAddressLookups.ts

_21
import { TwillioSDKDocs } from "Twilio-Communications-API";
_21
_21
async function run() {
_21
const sdk = new TwillioSDKDocs({
_21
security: {
_21
username: "<YOUR_USERNAME_HERE>",
_21
password: "<YOUR_PASSWORD_HERE>",
_21
},
_21
});
_21
_21
const address = "string";
_21
const startDate = new Date("2023-08-25T11:59:25.313Z");
_21
const endDate = new Date("2023-10-12T18:11:05.242Z");
_21
_21
const result = await sdk.addressLookups.listAddressLookups(address, startDate, endDate);
_21
_21
// Handle the result
_21
console.log(result)
_21
}
_21
_21
run();

Example Response

_34
{
_34
"address_lookups": [
_34
{
_34
"id": "addresslookup_01h9krwprkeee8fzqspvwy6nq8",
_34
"type": "phone_number",
_34
"address": "string",
_34
"calling_country_code": "string",
_34
"country_code": "string",
_34
"phone_number": "string",
_34
"national_format": "string",
_34
"valid": false,
_34
"validation_errors": [],
_34
"caller_name": {},
_34
"sim_swap": {},
_34
"call_forwarding": {},
_34
"live_activity": {},
_34
"line_type_intelligence": {},
_34
"identity_match": {},
_34
"reassigned_number": {},
_34
"sms_pumping_risk": {},
_34
"disposable_phone_number_risk": {},
_34
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_34
"operation_id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_34
"created_at": "2023-04-10T07:48:56.789Z",
_34
"updated_at": "2023-11-15T10:13:10.092Z"
_34
}
_34
],
_34
"pagination": {
_34
"page": 645894,
_34
"prev": "string",
_34
"next": "string",
_34
"self": "string"
_34
}
_34
}


Address Lookups

Fetch One Address Lookup

This operation fetches a single AddressLookup using its id.

Parameters

TypeScript
addressLookupId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneAddressLookupResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


addressLookup?: components.AddressLookup

OK


headers: Record<string, *string*[]>
FetchOneAddressLookup.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const addressLookupId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.addressLookups.fetchOneAddressLookup(addressLookupId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_20
{
_20
"id": "addresslookup_01h9krwprkeee8fzqspvwy6nq8",
_20
"type": "email",
_20
"address": "string",
_20
"validity_score": 8917.73,
_20
"local": "string",
_20
"domain": "awesome-voter.biz",
_20
"suggestion": "Jasper_Schiller47@yahoo.com",
_20
"checks": {
_20
"domain": [],
_20
"local": [],
_20
"bounces": []
_20
},
_20
"source": "string",
_20
"ip_address": "string",
_20
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_20
"operation_id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_20
"created_at": "2024-10-11T10:53:37.826Z",
_20
"updated_at": "2024-07-05T08:12:57.367Z"
_20
}


Contacts And Audiences

*Use Contacts to build and maintain a reliable directory of customers with validated communications addresses and identity profiles. Build up Audiences and leverage them with Messages, Emails, PushNotifications and Communications to broadcast communications to larger audiences*.

Available Operations


Contacts & Audiences

Create Contacts

This operation creates Contacts

Parameters

TypeScript
request: operations.CreateContactsCreateContactsRequest

The request object to use for the request.

Show child properties
contacts?: operations.ContactInput[]
Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateContactsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


createContactsResponse?: operations.CreateContactsCreateContactsResponse

Created

Show child properties

headers: Record<string, *string*[]>
CreateContacts.ts

_29
import { TwillioSDKDocs } from "Twilio-Communications-API";
_29
_29
async function run() {
_29
const sdk = new TwillioSDKDocs({
_29
security: {
_29
username: "<YOUR_USERNAME_HERE>",
_29
password: "<YOUR_PASSWORD_HERE>",
_29
},
_29
});
_29
_29
const result = await sdk.contactsAndAudiences.createContacts({
_29
contacts: [
_29
{
_29
addresses: [
_29
{},
_29
],
_29
location: {},
_29
tags: {
_29
"key": {},
_29
},
_29
},
_29
],
_29
});
_29
_29
// Handle the result
_29
console.log(result)
_29
}
_29
_29
run();

Example Response

_39
{
_39
"contacts": [
_39
{
_39
"first_name": "string",
_39
"last_name": "string",
_39
"display_name": "string",
_39
"user_identifier": "string",
_39
"location": {
_39
"latitude": 710.36,
_39
"longitude": 3373.96,
_39
"address_line_1": "string",
_39
"address_line_2": "string",
_39
"city": "string",
_39
"state": "string",
_39
"postal_code": "string",
_39
"country_code": "string"
_39
},
_39
"date_of_birth": "string",
_39
"national_id": "string",
_39
"id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_39
"addresses": [
_39
{
_39
"address": "string",
_39
"is_validated_by_lookup": false,
_39
"last_validated_by_lookup": "2023-12-12T09:30:46.948Z"
_39
}
_39
],
_39
"audiences": [
_39
{
_39
"audience_id": "audience_01h9krwprkeee8fzqspvwy6nq8"
_39
}
_39
],
_39
"tags": {},
_39
"operation_id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_39
"created_at": "2022-01-23T03:49:29.173Z",
_39
"updated_at": "2023-02-08T14:13:31.435Z"
_39
}
_39
]
_39
}


Contacts & Audiences

List Contacts

This operation fetches a paginated list of Contacts.

Parameters

TypeScript
request: operations.ListContactsRequest

The request object to use for the request.

Show child properties
startDate?: Date

Filter to Contacts created after the specified date and time.


endDate?: Date

Filter to Contacts created before the specified date and time.


updatedDate?: Date

Filter to Contacts updated after the specified date and time.


channel?: components.CommunicationChannel

Filter to Contacts that have at least one address belonging to a specific channel.

Show child properties

firstName?: string

Filter to Contacts that have a specific first_name value.


lastName?: string

Filter to Contacts that have a specific last_name value.


displayName?: string

Filter to Contacts that have a specific display_name value.


userIdentifier?: string

Filter to Contacts that have a specific user_identifier value.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListContactsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listContactsResponse?: operations.ListContactsListContactsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListContacts.ts

_18
import { TwillioSDKDocs } from "Twilio-Communications-API";
_18
import { CommunicationChannel } from "Twilio-Communications-API/models/components";
_18
_18
async function run() {
_18
const sdk = new TwillioSDKDocs({
_18
security: {
_18
username: "<YOUR_USERNAME_HERE>",
_18
password: "<YOUR_PASSWORD_HERE>",
_18
},
_18
});
_18
_18
const result = await sdk.contactsAndAudiences.listContacts({});
_18
_18
// Handle the result
_18
console.log(result)
_18
}
_18
_18
run();

Example Response

_45
{
_45
"contacts": [
_45
{
_45
"first_name": "string",
_45
"last_name": "string",
_45
"display_name": "string",
_45
"user_identifier": "string",
_45
"location": {
_45
"latitude": 8326.2,
_45
"longitude": 9571.56,
_45
"address_line_1": "string",
_45
"address_line_2": "string",
_45
"city": "string",
_45
"state": "string",
_45
"postal_code": "string",
_45
"country_code": "string"
_45
},
_45
"date_of_birth": "string",
_45
"national_id": "string",
_45
"id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_45
"addresses": [
_45
{
_45
"address": "string",
_45
"is_validated_by_lookup": false,
_45
"last_validated_by_lookup": "2022-06-03T19:47:12.657Z"
_45
}
_45
],
_45
"audiences": [
_45
{
_45
"audience_id": "audience_01h9krwprkeee8fzqspvwy6nq8"
_45
}
_45
],
_45
"tags": {},
_45
"operation_id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_45
"created_at": "2024-08-11T12:47:58.088Z",
_45
"updated_at": "2024-08-11T14:46:30.188Z"
_45
}
_45
],
_45
"pagination": {
_45
"page": 978619,
_45
"prev": "string",
_45
"next": "string",
_45
"self": "string"
_45
}
_45
}


Contacts & Audiences

Fetch Single Contact

This operation fetches a single contact using its ID.

Parameters

TypeScript
contactId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchSingleContactResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


contact?: components.Contact

OK

Show child properties

headers: Record<string, *string*[]>
FetchSingleContact.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const contactId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.contactsAndAudiences.fetchSingleContact(contactId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_35
{
_35
"first_name": "string",
_35
"last_name": "string",
_35
"display_name": "string",
_35
"user_identifier": "string",
_35
"location": {
_35
"latitude": 4736.08,
_35
"longitude": 7991.59,
_35
"address_line_1": "string",
_35
"address_line_2": "string",
_35
"city": "string",
_35
"state": "string",
_35
"postal_code": "string",
_35
"country_code": "string"
_35
},
_35
"date_of_birth": "string",
_35
"national_id": "string",
_35
"id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_35
"addresses": [
_35
{
_35
"address": "string",
_35
"is_validated_by_lookup": false,
_35
"last_validated_by_lookup": "2023-05-21T18:45:11.373Z"
_35
}
_35
],
_35
"audiences": [
_35
{
_35
"audience_id": "audience_01h9krwprkeee8fzqspvwy6nq8"
_35
}
_35
],
_35
"tags": {},
_35
"operation_id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_35
"created_at": "2023-07-25T10:38:22.728Z",
_35
"updated_at": "2024-05-05T11:02:21.971Z"
_35
}


Contacts & Audiences

Update Contact

This operation partially updates a Contact

Parameters

TypeScript
contactId: string

Example: [object Object]


requestBody?: operations.UpdateContactUpdateContactRequest
Show child properties
firstName?: string

lastName?: string

displayName?: string

addresses?: operations.UpdateContactAddress[]
Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateContactResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


contact?: components.Contact

Ok

Show child properties

headers: Record<string, *string*[]>
UpdateContact.ts

_27
import { TwillioSDKDocs } from "Twilio-Communications-API";
_27
_27
async function run() {
_27
const sdk = new TwillioSDKDocs({
_27
security: {
_27
username: "<YOUR_USERNAME_HERE>",
_27
password: "<YOUR_PASSWORD_HERE>",
_27
},
_27
});
_27
_27
const contactId = "01h9krwprkeee8fzqspvwy6nq8";
_27
const requestBody = {
_27
addresses: [
_27
{},
_27
],
_27
tags: {
_27
"key": {},
_27
},
_27
};
_27
_27
const result = await sdk.contactsAndAudiences.updateContact(contactId, requestBody);
_27
_27
// Handle the result
_27
console.log(result)
_27
}
_27
_27
run();

Example Response

_35
{
_35
"first_name": "string",
_35
"last_name": "string",
_35
"display_name": "string",
_35
"user_identifier": "string",
_35
"location": {
_35
"latitude": 6788.8,
_35
"longitude": 1182.74,
_35
"address_line_1": "string",
_35
"address_line_2": "string",
_35
"city": "string",
_35
"state": "string",
_35
"postal_code": "string",
_35
"country_code": "string"
_35
},
_35
"date_of_birth": "string",
_35
"national_id": "string",
_35
"id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_35
"addresses": [
_35
{
_35
"address": "string",
_35
"is_validated_by_lookup": false,
_35
"last_validated_by_lookup": "2023-12-03T08:28:56.752Z"
_35
}
_35
],
_35
"audiences": [
_35
{
_35
"audience_id": "audience_01h9krwprkeee8fzqspvwy6nq8"
_35
}
_35
],
_35
"tags": {},
_35
"operation_id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_35
"created_at": "2023-09-30T21:26:54.920Z",
_35
"updated_at": "2022-06-07T02:45:53.358Z"
_35
}


Contacts & Audiences

Delete Contact

This operation deletes a Contact

Parameters

TypeScript
contactId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeleteContactResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeleteContact.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const contactId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.contactsAndAudiences.deleteContact(contactId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 537373,
_10
"message": "string",
_10
"more_info": "https://sizzling-locust.com"
_10
}


Contacts & Audiences

Update Contacts Settings

This operation partially updates Contacts Settings

Parameters

TypeScript
request: operations.UpdateContactsSettingsUpdateContactSettings

The request object to use for the request.

Show child properties
autoCreateWith?: operations.AutoCreateWith[]

A list of related resources which, when created, will also automatically create (or update) a Contact when specifying a recipient/end-user.

Show child properties

autoValidateAddresses?: operations.ContactsSettingsAutoValidateAddresses
Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateContactsSettingsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


contactsSettings?: components.ContactsSettings

Ok

Show child properties

headers: Record<string, *string*[]>
UpdateContactsSettings.ts

_24
import { TwillioSDKDocs } from "Twilio-Communications-API";
_24
import { } from "Twilio-Communications-API/models";
_24
import { LookupOnCreateMode } from "Twilio-Communications-API/models/operations";
_24
_24
async function run() {
_24
const sdk = new TwillioSDKDocs({
_24
security: {
_24
username: "<YOUR_USERNAME_HERE>",
_24
password: "<YOUR_PASSWORD_HERE>",
_24
},
_24
});
_24
_24
const result = await sdk.contactsAndAudiences.updateContactsSettings({
_24
autoCreateWith: [
_24
AutoCreateWith.PushNotifications,
_24
],
_24
autoValidateAddresses: {},
_24
});
_24
_24
// Handle the result
_24
console.log(result)
_24
}
_24
_24
run();

Example Response

_10
{
_10
"auto_create_with": [],
_10
"auto_validate_addresses": {
_10
"lookup_refresh_interval": "string"
_10
}
_10
}


Contacts & Audiences

Fetch Contacts Settings

This operation fetches Contacts Settings

Parameters

TypeScript
options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchContactsSettingsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


contactsSettings?: components.ContactsSettings

OK

Show child properties

headers: Record<string, *string*[]>
FetchContactsSettings.ts

_17
import { TwillioSDKDocs } from "Twilio-Communications-API";
_17
_17
async function run() {
_17
const sdk = new TwillioSDKDocs({
_17
security: {
_17
username: "<YOUR_USERNAME_HERE>",
_17
password: "<YOUR_PASSWORD_HERE>",
_17
},
_17
});
_17
_17
const result = await sdk.contactsAndAudiences.fetchContactsSettings();
_17
_17
// Handle the result
_17
console.log(result)
_17
}
_17
_17
run();

Example Response

_10
{
_10
"auto_create_with": [],
_10
"auto_validate_addresses": {
_10
"lookup_refresh_interval": "string"
_10
}
_10
}


Contacts & Audiences

Create Preferences

This operation creates Preferences

Parameters

TypeScript
request: operations.CreatePreferencesCreatePreferenceRequest

The request object to use for the request.

Show child properties
name: string

The name of the Preference.


description?: string

The description of the Preference.


isPublic?: boolean

Whether the Preference is public or private.


channels: components.PreferenceChannelDefault[]

The channel controls available for the Preference

Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreatePreferencesResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


preference?: components.Preference

Created

Show child properties

headers: Record<string, *string*[]>
CreatePreferences.ts

_25
import { TwillioSDKDocs } from "Twilio-Communications-API";
_25
_25
async function run() {
_25
const sdk = new TwillioSDKDocs({
_25
security: {
_25
username: "<YOUR_USERNAME_HERE>",
_25
password: "<YOUR_PASSWORD_HERE>",
_25
},
_25
});
_25
_25
const result = await sdk.contactsAndAudiences.createPreferences({
_25
name: "string",
_25
channels: [
_25
{},
_25
],
_25
tags: {
_25
"key": {},
_25
},
_25
});
_25
_25
// Handle the result
_25
console.log(result)
_25
}
_25
_25
run();

Example Response

_15
{
_15
"id": "cb739205-9293-496f-aa75-96eb10faaa23",
_15
"name": "string",
_15
"description": "string",
_15
"is_public": false,
_15
"channels": [
_15
{
_15
"default_opt_in": false
_15
}
_15
],
_15
"tags": {},
_15
"created_at": "2022-05-22T07:16:38.466Z",
_15
"updated_at": "2024-04-02T18:02:53.509Z",
_15
"deleted_at": "2022-12-12T17:01:38.313Z"
_15
}


Contacts & Audiences

List Preferences

This operation fetches a paginated list of Preferences

Parameters

TypeScript
options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListPreferencesResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listPreferencesResponse?: operations.ListPreferencesListPreferencesResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListPreferences.ts

_17
import { TwillioSDKDocs } from "Twilio-Communications-API";
_17
_17
async function run() {
_17
const sdk = new TwillioSDKDocs({
_17
security: {
_17
username: "<YOUR_USERNAME_HERE>",
_17
password: "<YOUR_PASSWORD_HERE>",
_17
},
_17
});
_17
_17
const result = await sdk.contactsAndAudiences.listPreferences();
_17
_17
// Handle the result
_17
console.log(result)
_17
}
_17
_17
run();

Example Response

_25
{
_25
"preferences": [
_25
{
_25
"id": "955907af-f1a3-4a2f-a946-7739251aa52c",
_25
"name": "string",
_25
"description": "string",
_25
"is_public": false,
_25
"channels": [
_25
{
_25
"default_opt_in": false
_25
}
_25
],
_25
"tags": {},
_25
"created_at": "2024-11-06T17:31:00.970Z",
_25
"updated_at": "2023-02-09T02:56:48.333Z",
_25
"deleted_at": "2023-12-28T03:06:24.254Z"
_25
}
_25
],
_25
"pagination": {
_25
"page": 820994,
_25
"prev": "string",
_25
"next": "string",
_25
"self": "string"
_25
}
_25
}


Contacts & Audiences

Fetch One Preference

This operation fetches a single Preference using its id.

Parameters

TypeScript
preferenceId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOnePreferenceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


preference?: components.Preference

OK

Show child properties

headers: Record<string, *string*[]>
FetchOnePreference.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const preferenceId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.contactsAndAudiences.fetchOnePreference(preferenceId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_15
{
_15
"id": "019da1ff-e78f-4097-b007-4f15471b5e6e",
_15
"name": "string",
_15
"description": "string",
_15
"is_public": false,
_15
"channels": [
_15
{
_15
"default_opt_in": false
_15
}
_15
],
_15
"tags": {},
_15
"created_at": "2022-08-26T15:17:21.807Z",
_15
"updated_at": "2024-01-29T22:47:11.859Z",
_15
"deleted_at": "2023-09-12T10:43:40.519Z"
_15
}


Contacts & Audiences

Update One Preference

This operation updates a single Preference using its id.

Parameters

TypeScript
preferenceId: string

Example: [object Object]


requestBody: operations.UpdateOnePreferenceUpdatePreferenceRequest
Show child properties
name?: string

The name of the Preference.


channels?: components.CommunicationType[]

The channel controls available for the Preference

Show child properties

isPublic?: boolean

Whether the Preference is public or private. Use this to seperate Preferences that should and should not be exposed to your Contacts. Filter Contact Preferences by this field to determine which Contact Preferences to show in your UI.


tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateOnePreferenceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


preference?: components.Preference

OK

Show child properties

headers: Record<string, *string*[]>
UpdateOnePreference.ts

_28
import { TwillioSDKDocs } from "Twilio-Communications-API";
_28
import { } from "Twilio-Communications-API/models";
_28
_28
async function run() {
_28
const sdk = new TwillioSDKDocs({
_28
security: {
_28
username: "<YOUR_USERNAME_HERE>",
_28
password: "<YOUR_PASSWORD_HERE>",
_28
},
_28
});
_28
_28
const preferenceId = "01h9krwprkeee8fzqspvwy6nq8";
_28
const requestBody = {
_28
channels: [
_28
CommunicationType.PushNotification,
_28
],
_28
tags: {
_28
"key": {},
_28
},
_28
};
_28
_28
const result = await sdk.contactsAndAudiences.updateOnePreference(preferenceId, requestBody);
_28
_28
// Handle the result
_28
console.log(result)
_28
}
_28
_28
run();

Example Response

_15
{
_15
"id": "9d488e1e-91e4-450a-92ab-d44269802d50",
_15
"name": "string",
_15
"description": "string",
_15
"is_public": false,
_15
"channels": [
_15
{
_15
"default_opt_in": false
_15
}
_15
],
_15
"tags": {},
_15
"created_at": "2024-01-13T21:17:10.500Z",
_15
"updated_at": "2023-09-17T07:14:33.032Z",
_15
"deleted_at": "2022-10-23T22:17:22.586Z"
_15
}


Contacts & Audiences

Delete One Preference

This operation deletes a single Preference using its id.

Parameters

TypeScript
preferenceId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeleteOnePreferenceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeleteOnePreference.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const preferenceId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.contactsAndAudiences.deleteOnePreference(preferenceId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 703737,
_10
"message": "string",
_10
"more_info": "https://flashy-void.info"
_10
}


Contacts & Audiences

List Contact Preferences

This operation fetches a paginated list of Preferences

Parameters

TypeScript
contactId: string

Example: [object Object]


isPublic?: boolean

Filter to public or private Preferences.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListContactPreferencesResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listContactPreferencesResponse?: operations.ListContactPreferencesListContactPreferencesResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListContactPreferences.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const contactId = "01h9krwprkeee8fzqspvwy6nq8";
_20
const isPublic = false;
_20
_20
const result = await sdk.contactsAndAudiences.listContactPreferences(contactId, isPublic);
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_34
{
_34
"preferences": [
_34
{
_34
"id": "3c969e9a-3efa-477d-bb14-cd66ae395efb",
_34
"preference": {
_34
"id": "9ba88f3a-6699-4707-8ba4-469b6e214195",
_34
"name": "string",
_34
"description": "string",
_34
"is_public": false,
_34
"channels": [
_34
{
_34
"default_opt_in": false
_34
}
_34
],
_34
"tags": {},
_34
"created_at": "2023-08-28T18:58:29.186Z",
_34
"updated_at": "2023-09-22T11:03:05.504Z",
_34
"deleted_at": "2022-02-06T20:28:28.078Z"
_34
},
_34
"channels": [
_34
{}
_34
],
_34
"created_at": "2023-12-16T16:55:28.304Z",
_34
"updated_at": "2022-12-18T19:30:41.398Z",
_34
"deleted_at": "2023-04-18T20:01:49.802Z"
_34
}
_34
],
_34
"pagination": {
_34
"page": 221262,
_34
"prev": "string",
_34
"next": "string",
_34
"self": "string"
_34
}
_34
}


Contacts & Audiences

Fetch One Contact Preference

This operation fetches a single Contact Preference using its id.

Parameters

TypeScript
contactId: string

Example: [object Object]


contactPreferenceId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneContactPreferenceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


contactPreference?: components.ContactPreference

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneContactPreference.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const contactId = "01h9krwprkeee8fzqspvwy6nq8";
_20
const contactPreferenceId = "01h9krwprkeee8fzqspvwy6nq8";
_20
_20
const result = await sdk.contactsAndAudiences.fetchOneContactPreference(contactId, contactPreferenceId);
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_24
{
_24
"id": "e2516fe4-c8b7-411e-9b7f-d2ed028921cd",
_24
"preference": {
_24
"id": "dc692601-fb57-46b0-95f0-d30c5fbb2587",
_24
"name": "string",
_24
"description": "string",
_24
"is_public": false,
_24
"channels": [
_24
{
_24
"default_opt_in": false
_24
}
_24
],
_24
"tags": {},
_24
"created_at": "2023-01-07T12:39:52.211Z",
_24
"updated_at": "2022-08-08T04:42:30.977Z",
_24
"deleted_at": "2022-07-16T17:18:43.234Z"
_24
},
_24
"channels": [
_24
{}
_24
],
_24
"created_at": "2024-05-19T21:25:27.717Z",
_24
"updated_at": "2023-05-23T22:36:52.119Z",
_24
"deleted_at": "2022-09-03T10:06:53.474Z"
_24
}


Contacts & Audiences

Update One Contact Preference

This operation updates a single Contact Preference using its id.

Parameters

TypeScript
contactId: string

Example: [object Object]


contactPreferenceId: string

Example: [object Object]


requestBody: operations.UpdateOneContactPreferenceUpdatePreferenceRequest
Show child properties
channels?: components.PreferenceChannel[]

A list of channels and their associated statuses that determine whether a Contact can receive communications on that channel.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateOneContactPreferenceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


contactPreference?: components.ContactPreference

OK

Show child properties

headers: Record<string, *string*[]>
UpdateOneContactPreference.ts

_28
import { TwillioSDKDocs } from "Twilio-Communications-API";
_28
_28
async function run() {
_28
const sdk = new TwillioSDKDocs({
_28
security: {
_28
username: "<YOUR_USERNAME_HERE>",
_28
password: "<YOUR_PASSWORD_HERE>",
_28
},
_28
});
_28
_28
const contactId = "01h9krwprkeee8fzqspvwy6nq8";
_28
const contactPreferenceId = "01h9krwprkeee8fzqspvwy6nq8";
_28
const requestBody = {
_28
channels: [
_28
{
_28
channel: CommunicationType.Email,
_28
status: PreferenceChannelStatus.DefaultedOptOut,
_28
},
_28
],
_28
};
_28
_28
const result = await sdk.contactsAndAudiences.updateOneContactPreference(contactId, contactPreferenceId, requestBody);
_28
_28
// Handle the result
_28
console.log(result)
_28
}
_28
_28
run();

Example Response

_24
{
_24
"id": "d5fe9b90-c289-409b-bfe4-9a8d9cbf4863",
_24
"preference": {
_24
"id": "3323f9b7-7f3a-4410-8674-ebf69280d1ba",
_24
"name": "string",
_24
"description": "string",
_24
"is_public": false,
_24
"channels": [
_24
{
_24
"default_opt_in": false
_24
}
_24
],
_24
"tags": {},
_24
"created_at": "2023-05-13T06:02:29.999Z",
_24
"updated_at": "2024-01-13T01:57:13.620Z",
_24
"deleted_at": "2023-08-12T02:10:46.219Z"
_24
},
_24
"channels": [
_24
{}
_24
],
_24
"created_at": "2024-02-23T07:23:17.235Z",
_24
"updated_at": "2024-12-21T09:52:32.288Z",
_24
"deleted_at": "2023-05-30T13:39:14.475Z"
_24
}


Contacts & Audiences

Create Audience

This operation creates an Audience

Parameters

TypeScript
request: operations.CreateAudienceCreateAudienceRequest

The request object to use for the request.

Show child properties
name?: string

A friendly name for the Audience.


tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateAudienceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


audience?: components.Audience

Created

Show child properties

headers: Record<string, *string*[]>
CreateAudience.ts

_21
import { TwillioSDKDocs } from "Twilio-Communications-API";
_21
_21
async function run() {
_21
const sdk = new TwillioSDKDocs({
_21
security: {
_21
username: "<YOUR_USERNAME_HERE>",
_21
password: "<YOUR_PASSWORD_HERE>",
_21
},
_21
});
_21
_21
const result = await sdk.contactsAndAudiences.createAudience({
_21
tags: {
_21
"key": {},
_21
},
_21
});
_21
_21
// Handle the result
_21
console.log(result)
_21
}
_21
_21
run();

Example Response

_10
{
_10
"id": "audience_01h9krwprkeee8fzqspvwy6nq8",
_10
"name": "string",
_10
"contact_count": 216897,
_10
"tags": {},
_10
"created_at": "2023-05-15T19:00:31.154Z",
_10
"updated_at": "2023-12-28T17:36:32.640Z",
_10
"deleted_at": "2024-09-20T10:25:17.071Z"
_10
}


Contacts & Audiences

List Audiences

This operation fetches a paginated list of Audiences.

Parameters

TypeScript
startDate?: Date

Filter to Audiences created after the specified date and time.


endDate?: Date

Filter to Audiences created before the specified date and time.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListAudiencesResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listAudiencesResponse?: operations.ListAudiencesListAudiencesResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListAudiences.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const startDate = new Date("2023-08-21T04:36:25.552Z");
_20
const endDate = new Date("2024-07-17T14:06:34.909Z");
_20
_20
const result = await sdk.contactsAndAudiences.listAudiences(startDate, endDate);
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_19
{
_19
"audiences": [
_19
{
_19
"id": "audience_01h9krwprkeee8fzqspvwy6nq8",
_19
"name": "string",
_19
"contact_count": 263322,
_19
"tags": {},
_19
"created_at": "2022-05-31T09:26:45.422Z",
_19
"updated_at": "2022-01-23T15:12:14.503Z",
_19
"deleted_at": "2022-09-09T05:23:06.262Z"
_19
}
_19
],
_19
"pagination": {
_19
"page": 758379,
_19
"prev": "string",
_19
"next": "string",
_19
"self": "string"
_19
}
_19
}


Contacts & Audiences

Fetch Single Audience

This operation fetches a single Audience using its Id.

Parameters

TypeScript
audienceId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchSingleAudienceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


audience?: components.Audience

OK

Show child properties

headers: Record<string, *string*[]>
FetchSingleAudience.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const audienceId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.contactsAndAudiences.fetchSingleAudience(audienceId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"id": "audience_01h9krwprkeee8fzqspvwy6nq8",
_10
"name": "string",
_10
"contact_count": 881586,
_10
"tags": {},
_10
"created_at": "2022-12-17T17:43:51.515Z",
_10
"updated_at": "2024-09-18T05:59:40.567Z",
_10
"deleted_at": "2023-02-25T06:38:03.101Z"
_10
}


Contacts & Audiences

Delete Audience

This operation deletes an Audience using its Id.

Parameters

TypeScript
audienceId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeleteAudienceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeleteAudience.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const audienceId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.contactsAndAudiences.deleteAudience(audienceId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 645785,
_10
"message": "string",
_10
"more_info": "https://gaseous-spank.name"
_10
}


Contacts & Audiences

Add Contact To Audience

This operation adds a Contact to an Audience

Parameters

TypeScript
audienceId: string

Example: [object Object]


requestBody?: operations.AddContactToAudienceAddContactToAudienceRequest
Show child properties
contactId?: string

A reference to a Contact.


Example: contact_01h9krwprkeee8fzqspvwy6nq8


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.AddContactToAudienceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


audience?: components.Audience

Created

Show child properties

headers: Record<string, *string*[]>
AddContactToAudience.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const audienceId = "01h9krwprkeee8fzqspvwy6nq8";
_22
const requestBody = {
_22
contactId: "contact_01h9krwprkeee8fzqspvwy6nq8",
_22
};
_22
_22
const result = await sdk.contactsAndAudiences.addContactToAudience(audienceId, requestBody);
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_10
{
_10
"id": "audience_01h9krwprkeee8fzqspvwy6nq8",
_10
"name": "string",
_10
"contact_count": 628982,
_10
"tags": {},
_10
"created_at": "2022-01-01T01:27:21.369Z",
_10
"updated_at": "2024-08-14T10:12:10.426Z",
_10
"deleted_at": "2022-12-08T19:10:16.465Z"
_10
}


Contacts & Audiences

List Contacts In Audience

This operation fetches a paginated list of Contacts that belong to an Audience.

Parameters

TypeScript
audienceId: string

Example: [object Object]


startDate?: Date

Filter to Contacts that were added to the Audience after the specified date and time.


endDate?: Date

Filter to Contacts that were added to the Audience before the specified date and time.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListContactsInAudienceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listContactsInAudienceResponse?: operations.ListContactsInAudienceListContactsInAudienceResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListContactsInAudience.ts

_21
import { TwillioSDKDocs } from "Twilio-Communications-API";
_21
_21
async function run() {
_21
const sdk = new TwillioSDKDocs({
_21
security: {
_21
username: "<YOUR_USERNAME_HERE>",
_21
password: "<YOUR_PASSWORD_HERE>",
_21
},
_21
});
_21
_21
const audienceId = "01h9krwprkeee8fzqspvwy6nq8";
_21
const startDate = new Date("2023-04-10T07:48:56.789Z");
_21
const endDate = new Date("2023-11-15T10:13:10.092Z");
_21
_21
const result = await sdk.contactsAndAudiences.listContactsInAudience(audienceId, startDate, endDate);
_21
_21
// Handle the result
_21
console.log(result)
_21
}
_21
_21
run();

Example Response

_45
{
_45
"contacts": [
_45
{
_45
"first_name": "string",
_45
"last_name": "string",
_45
"display_name": "string",
_45
"user_identifier": "string",
_45
"location": {
_45
"latitude": 2735.42,
_45
"longitude": 4254.51,
_45
"address_line_1": "string",
_45
"address_line_2": "string",
_45
"city": "string",
_45
"state": "string",
_45
"postal_code": "string",
_45
"country_code": "string"
_45
},
_45
"date_of_birth": "string",
_45
"national_id": "string",
_45
"id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_45
"addresses": [
_45
{
_45
"address": "string",
_45
"is_validated_by_lookup": false,
_45
"last_validated_by_lookup": "2024-08-28T07:55:18.917Z"
_45
}
_45
],
_45
"audiences": [
_45
{
_45
"audience_id": "audience_01h9krwprkeee8fzqspvwy6nq8"
_45
}
_45
],
_45
"tags": {},
_45
"operation_id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_45
"created_at": "2022-07-23T10:58:04.259Z",
_45
"updated_at": "2024-01-16T03:32:57.054Z"
_45
}
_45
],
_45
"pagination": {
_45
"page": 952792,
_45
"prev": "string",
_45
"next": "string",
_45
"self": "string"
_45
}
_45
}


Contacts & Audiences

Remove Contact From Audience

This operation removes a Contact from an Audience

Parameters

TypeScript
audienceId: string

Example: [object Object]


contactId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.RemoveContactFromAudienceResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
RemoveContactFromAudience.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const audienceId = "01h9krwprkeee8fzqspvwy6nq8";
_20
const contactId = "contact_01h9krwprkeee8fzqspvwy6nq8";
_20
_20
const result = await sdk.contactsAndAudiences.removeContactFromAudience(audienceId, contactId);
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_10
{
_10
"code": 456130,
_10
"message": "string",
_10
"more_info": "https://left-cousin.net"
_10
}


Emails

*Use Emails to send and receive email with Twilio SendGrid.*

Available Operations


Emails

Send Emails

This operation creates and sends out emails to the specified recipients.

Parameters

TypeScript
request: operations.SendEmailsSendEmailsRequest

The request object to use for the request.

Show child properties
from: operations.SendEmailsRequestFrom

The sending identity to associate with the email.


to?: *operations.SendEmailsRecipient*[]

A list of recipients to send the email(s) to.


content: operations.SendEmailsRequestContent

The content of the Email. - Use EmailContentInput to construct the content of your Email. - Use OTPEmailContentInput to send an Email with an OTP to Verify your recipient. - Use EmailContentTemplateInput to reference a stored Content template.


replyTo?: *operations.SendEmailsRequestReplyToRecipient*[]

A list of recipients to send replies to when the recipient of this email attempts to reply.


cc?: *operations.SendEmailsRequestCCRecipient*[]

A list of recipients to carbon-copy ('cc') emails to. Recipients will have visibility of eachother's addresses.


bcc?: *operations.SendEmailsRequestBCCRecipient*[]

A list of recipients to blindly carbon-copy ('cc') emails to. Recipients will NOT have visibility of eachother's addresses.


tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

processingOptions?: operations.SendEmailsRequestProcessingOptions

Additional options to control how the email is processed.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.SendEmailsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


sendEmailsResponse?: operations.SendEmailsSendEmailsResponse

Created

Show child properties

headers: Record<string, *string*[]>
SendEmails.ts

_38
import { TwillioSDKDocs } from "Twilio-Communications-API";
_38
_38
async function run() {
_38
const sdk = new TwillioSDKDocs({
_38
security: {
_38
username: "<YOUR_USERNAME_HERE>",
_38
password: "<YOUR_PASSWORD_HERE>",
_38
},
_38
});
_38
_38
const result = await sdk.emails.sendEmails({
_38
to: [
_38
,
_38
],
_38
replyTo: [
_38
,
_38
],
_38
cc: [
_38
,
_38
],
_38
bcc: [
_38
,
_38
],
_38
tags: {
_38
"key": {},
_38
},
_38
processingOptions: {
_38
usePreference: {
_38
preferenceId: "preference_01h9krwprkeee8fzqspvwy6nq8",
_38
},
_38
},
_38
});
_38
_38
// Handle the result
_38
console.log(result)
_38
}
_38
_38
run();

Example Response

_99
{
_99
"emails": [
_99
{
_99
"id": "email_01h9krwprkeee8fzqspvwy6nq8",
_99
"content": {
_99
"subject": "string",
_99
"text": "string",
_99
"html": "string",
_99
"default_variables": {},
_99
"attachments": [
_99
{
_99
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_99
"file_name": "string",
_99
"file_size": 2294.42,
_99
"mime_type": "text/plain",
_99
"content_reference": {
_99
"temporary_url": "https://unacceptable-destiny.biz",
_99
"expires_at": "2022-08-22T18:57:29.475Z"
_99
},
_99
"tags": {},
_99
"created_by": {
_99
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8"
_99
},
_99
"updated_at": "2023-07-22T22:45:05.441Z",
_99
"created_at": "2023-06-02T00:57:12.422Z",
_99
"deleted_at": "2022-01-29T03:01:55.252Z"
_99
}
_99
]
_99
},
_99
"from": {
_99
"address": "string",
_99
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_99
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_99
},
_99
"to": [
_99
{
_99
"address": "string",
_99
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_99
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_99
}
_99
],
_99
"reply_to": [
_99
{
_99
"address": "string",
_99
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_99
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_99
}
_99
],
_99
"cc": [
_99
{
_99
"address": "string",
_99
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_99
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_99
}
_99
],
_99
"bcc": [
_99
{
_99
"address": "string",
_99
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_99
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_99
}
_99
],
_99
"delivery_status": {
_99
"total_count": 711584,
_99
"queued": {
_99
"count": 207470
_99
},
_99
"sent": {
_99
"count": 424685
_99
},
_99
"delivered": {
_99
"count": 374170
_99
},
_99
"read": {
_99
"count": 463575
_99
},
_99
"opened": {
_99
"count": 277628
_99
},
_99
"undelivered": {
_99
"count": 586784
_99
},
_99
"failed": {
_99
"count": 863856
_99
}
_99
},
_99
"related": [
_99
{
_99
"id": "string",
_99
"uri": "string"
_99
}
_99
],
_99
"tags": {},
_99
"created_at": "2023-07-22T01:08:24.502Z",
_99
"updated_at": "2022-10-31T11:24:47.724Z",
_99
"deleted_at": "2022-05-25T17:55:10.407Z"
_99
}
_99
]
_99
}


Emails

List Emails

This operation fetches a paginated list of Emails.

Parameters

TypeScript
request: operations.ListEmailsRequest

The request object to use for the request.

Show child properties
operationId?: string

Filter to Emails created in a specific Operation.


Example: operation_01h9krwprkeee8fzqspvwy6nq8


conversationId?: string

Filter Messages belonging to a conversation.


Example: conversation_01h9krwprkeee8fzqspvwy6nq8


startDate?: Date

Filter Emails created after the specified date and time.


endDate?: Date

Filter Emails created before the specified date and time.


fromAddress?: string

Filter Emails sent from an address.


toAddress?: string

Filter Emails sent to an address.


toContact?: string

Filter Emails sent to a specific Contact.


Example: contact_01h9krwprkeee8fzqspvwy6nq8


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListEmailsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listEmailsResponse?: operations.ListEmailsListEmailsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListEmails.ts

_21
import { TwillioSDKDocs } from "Twilio-Communications-API";
_21
_21
async function run() {
_21
const sdk = new TwillioSDKDocs({
_21
security: {
_21
username: "<YOUR_USERNAME_HERE>",
_21
password: "<YOUR_PASSWORD_HERE>",
_21
},
_21
});
_21
_21
const result = await sdk.emails.listEmails({
_21
operationId: "operation_01h9krwprkeee8fzqspvwy6nq8",
_21
conversationId: "conversation_01h9krwprkeee8fzqspvwy6nq8",
_21
toContact: "contact_01h9krwprkeee8fzqspvwy6nq8",
_21
});
_21
_21
// Handle the result
_21
console.log(result)
_21
}
_21
_21
run();

Example Response

_105
{
_105
"emails": [
_105
{
_105
"id": "email_01h9krwprkeee8fzqspvwy6nq8",
_105
"content": {
_105
"subject": "string",
_105
"text": "string",
_105
"html": "string",
_105
"default_variables": {},
_105
"attachments": [
_105
{
_105
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_105
"file_name": "string",
_105
"file_size": 7168.6,
_105
"mime_type": "text/plain",
_105
"content_reference": {
_105
"temporary_url": "https://humming-innocent.name",
_105
"expires_at": "2024-07-10T02:37:55.899Z"
_105
},
_105
"tags": {},
_105
"created_by": {
_105
"address": "string"
_105
},
_105
"updated_at": "2022-06-08T18:04:31.965Z",
_105
"created_at": "2022-06-30T19:04:41.355Z",
_105
"deleted_at": "2023-06-19T21:49:57.037Z"
_105
}
_105
]
_105
},
_105
"from": {
_105
"address": "string",
_105
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_105
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_105
},
_105
"to": [
_105
{
_105
"address": "string",
_105
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_105
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_105
}
_105
],
_105
"reply_to": [
_105
{
_105
"address": "string",
_105
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_105
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_105
}
_105
],
_105
"cc": [
_105
{
_105
"address": "string",
_105
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_105
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_105
}
_105
],
_105
"bcc": [
_105
{
_105
"address": "string",
_105
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_105
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_105
}
_105
],
_105
"delivery_status": {
_105
"total_count": 124833,
_105
"queued": {
_105
"count": 355613
_105
},
_105
"sent": {
_105
"count": 940432
_105
},
_105
"delivered": {
_105
"count": 765326
_105
},
_105
"read": {
_105
"count": 748664
_105
},
_105
"opened": {
_105
"count": 903720
_105
},
_105
"undelivered": {
_105
"count": 83422
_105
},
_105
"failed": {
_105
"count": 552193
_105
}
_105
},
_105
"related": [
_105
{
_105
"id": "string",
_105
"uri": "string"
_105
}
_105
],
_105
"tags": {},
_105
"created_at": "2024-11-20T06:46:28.675Z",
_105
"updated_at": "2022-08-18T05:39:59.272Z",
_105
"deleted_at": "2022-11-17T04:38:55.132Z"
_105
}
_105
],
_105
"pagination": {
_105
"page": 286915,
_105
"prev": "string",
_105
"next": "string",
_105
"self": "string"
_105
}
_105
}


Emails

Fetch One Email

This operation fetches a single Email using its id.

Parameters

TypeScript
emailId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneEmailResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


email?: components.Email

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneEmail.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const emailId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.emails.fetchOneEmail(emailId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_95
{
_95
"id": "email_01h9krwprkeee8fzqspvwy6nq8",
_95
"content": {
_95
"subject": "string",
_95
"text": "string",
_95
"html": "string",
_95
"default_variables": {},
_95
"attachments": [
_95
{
_95
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_95
"file_name": "string",
_95
"file_size": 6772.63,
_95
"mime_type": "text/plain",
_95
"content_reference": {
_95
"temporary_url": "http://basic-aim.name",
_95
"expires_at": "2024-10-15T18:20:21.062Z"
_95
},
_95
"tags": {},
_95
"created_by": {
_95
"address": "string"
_95
},
_95
"updated_at": "2024-07-02T00:14:02.554Z",
_95
"created_at": "2024-05-10T12:39:43.747Z",
_95
"deleted_at": "2024-12-14T19:48:05.144Z"
_95
}
_95
]
_95
},
_95
"from": {
_95
"address": "string",
_95
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_95
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_95
},
_95
"to": [
_95
{
_95
"address": "string",
_95
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_95
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_95
}
_95
],
_95
"reply_to": [
_95
{
_95
"address": "string",
_95
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_95
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_95
}
_95
],
_95
"cc": [
_95
{
_95
"address": "string",
_95
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_95
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_95
}
_95
],
_95
"bcc": [
_95
{
_95
"address": "string",
_95
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_95
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_95
}
_95
],
_95
"delivery_status": {
_95
"total_count": 281730,
_95
"queued": {
_95
"count": 703495
_95
},
_95
"sent": {
_95
"count": 181631
_95
},
_95
"delivered": {
_95
"count": 512393
_95
},
_95
"read": {
_95
"count": 580447
_95
},
_95
"opened": {
_95
"count": 787542
_95
},
_95
"undelivered": {
_95
"count": 606476
_95
},
_95
"failed": {
_95
"count": 218403
_95
}
_95
},
_95
"related": [
_95
{
_95
"id": "string",
_95
"uri": "string"
_95
}
_95
],
_95
"tags": {},
_95
"created_at": "2024-08-21T05:47:22.603Z",
_95
"updated_at": "2024-11-06T10:52:56.237Z",
_95
"deleted_at": "2023-06-24T12:37:25.611Z"
_95
}


Emails

Delete Email

This operation deletes an Email

Parameters

TypeScript
emailId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeleteEmailResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeleteEmail.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const emailId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.emails.deleteEmail(emailId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 941378,
_10
"message": "string",
_10
"more_info": "https://starchy-kazoo.name"
_10
}


Emails

List Email Operations

This operation fetches a paginated list of Email Operations.

Parameters

TypeScript
startDate?: Date

Filter to Operations created after the specified date and time.


endDate?: Date

Filter to Operations created before the specified date and time.


status?: components.EmailOperationStatus

Filter to Operations with the specified status.

Show child properties
NameValue
processingprocessing
completedcompleted
canceledcanceled
failedfailed

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListEmailOperationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listEmailOperationsResponse?: operations.ListEmailOperationsListEmailOperationsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListEmailOperations.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
import { EmailOperationStatus } from "Twilio-Communications-API/models/components";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const startDate = new Date("2023-12-09T21:35:55.692Z");
_22
const endDate = new Date("2023-02-26T06:46:35.231Z");
_22
const status = EmailOperationStatus.Completed;
_22
_22
const result = await sdk.emails.listEmailOperations(startDate, endDate, status);
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_39
{
_39
"operations": [
_39
{
_39
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_39
"delivery": {
_39
"total_count": 874288,
_39
"queued": {
_39
"count": 498140
_39
},
_39
"sent": {
_39
"count": 844550
_39
},
_39
"delivered": {
_39
"count": 194342
_39
},
_39
"read": {
_39
"count": 773326
_39
},
_39
"opened": {
_39
"count": 974259
_39
},
_39
"undelivered": {
_39
"count": 862310
_39
},
_39
"failed": {
_39
"count": 780427
_39
}
_39
},
_39
"created_at": "2024-12-15T14:17:20.778Z",
_39
"updated_at": "2023-06-09T07:03:09.156Z"
_39
}
_39
],
_39
"pagination": {
_39
"page": 753570,
_39
"prev": "string",
_39
"next": "string",
_39
"self": "string"
_39
}
_39
}


Emails

Fetch One Email Operation

This operation fetches a single Email Operation using its id.

Parameters

TypeScript
operationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneEmailOperationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


emailOperation?: components.EmailOperation

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneEmailOperation.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const operationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.emails.fetchOneEmailOperation(operationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_29
{
_29
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_29
"delivery": {
_29
"total_count": 4048,
_29
"queued": {
_29
"count": 639473
_29
},
_29
"sent": {
_29
"count": 368584
_29
},
_29
"delivered": {
_29
"count": 136900
_29
},
_29
"read": {
_29
"count": 822118
_29
},
_29
"opened": {
_29
"count": 189848
_29
},
_29
"undelivered": {
_29
"count": 511319
_29
},
_29
"failed": {
_29
"count": 224317
_29
}
_29
},
_29
"created_at": "2022-04-18T05:42:04.906Z",
_29
"updated_at": "2023-03-22T02:35:35.890Z"
_29
}


Emails

Cancel Email Operation

This operation cancels an Email Operation using its id.

Parameters

TypeScript
operationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CancelEmailOperationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


emailOperation?: components.EmailOperation

OK

Show child properties

headers: Record<string, *string*[]>
CancelEmailOperation.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const operationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.emails.cancelEmailOperation(operationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_29
{
_29
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_29
"delivery": {
_29
"total_count": 569211,
_29
"queued": {
_29
"count": 972920
_29
},
_29
"sent": {
_29
"count": 960835
_29
},
_29
"delivered": {
_29
"count": 906556
_29
},
_29
"read": {
_29
"count": 774048
_29
},
_29
"opened": {
_29
"count": 333145
_29
},
_29
"undelivered": {
_29
"count": 81101
_29
},
_29
"failed": {
_29
"count": 407241
_29
}
_29
},
_29
"created_at": "2022-09-12T12:41:12.694Z",
_29
"updated_at": "2024-10-12T03:06:17.933Z"
_29
}


Messages

*Use Messages to send and receive SMS & MMS, WhatsApp, Facebook Messenger, and Google Business messages.*

Available Operations


Messages

Send Messages

This operation creates and sends out messages to the specified recipients.

Parameters

TypeScript
request: operations.SendMessagesSendMessagesRequest

The request object to use for the request.

Show child properties
from: operations.SendMessagesRequestFrom

The sending identity to associate with the Message(s).


to: *operations.SendMessagesRecipient*[]

An array of recipient objects to send the message(s) to. - Use an AddressRecipient to describe the recipient by their address. - Use a ContactRecipient to reference a stored Contact. - Use a RecipientGroup for Group Messaging. - Use a ConversationRecipient to add a Message to a Conversation.


content: operations.SendMessagesRequestContent

The content of the Message. - Use MessagesRequestContent to specify simple content for your Message. - Use MessagesRequestContentRich to construct rich content for your Message - Use MessagesRequestContentOTP to send a Message with an OTP to Verify your recipient. - Use MessagesRequestContentTemplate to reference a stored Content template


processingOptions?: operations.SendMessagesRequestProcessingOptions

Directives for how to process and dispatch the Message(s).

Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.SendMessagesResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


sendMessagesResponse?: operations.SendMessagesSendMessagesResponse

Created

Show child properties

headers: Record<string, *string*[]>
SendMessages.ts

_30
import { TwillioSDKDocs } from "Twilio-Communications-API";
_30
_30
async function run() {
_30
const sdk = new TwillioSDKDocs({
_30
security: {
_30
username: "<YOUR_USERNAME_HERE>",
_30
password: "<YOUR_PASSWORD_HERE>",
_30
},
_30
});
_30
_30
const result = await sdk.messages.sendMessages({
_30
to: [
_30
,
_30
],
_30
processingOptions: {
_30
domain: "domain_01h9krwprkeee8fzqspvwy6nq8",
_30
usePreference: {
_30
preferenceId: "preference_01h9krwprkeee8fzqspvwy6nq8",
_30
},
_30
},
_30
tags: {
_30
"key": {},
_30
},
_30
});
_30
_30
// Handle the result
_30
console.log(result)
_30
}
_30
_30
run();

Example Response

_121
{
_121
"messages": [
_121
{
_121
"id": "message_01h9krwprkeee8fzqspvwy6nq8",
_121
"content": {
_121
"text": "string",
_121
"media": [
_121
{
_121
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_121
"file_name": "string",
_121
"file_size": 3253.1,
_121
"mime_type": "text/plain",
_121
"content_reference": {
_121
"temporary_url": "http://weepy-reamer.com",
_121
"expires_at": "2022-01-13T12:35:16.005Z"
_121
},
_121
"tags": {},
_121
"created_by": {
_121
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_121
},
_121
"updated_at": "2024-04-24T13:21:21.659Z",
_121
"created_at": "2022-11-30T19:43:32.608Z",
_121
"deleted_at": "2022-06-11T01:17:04.060Z"
_121
}
_121
],
_121
"location": {
_121
"title": "string",
_121
"latitude": 8828.6,
_121
"longitude": 795.22
_121
},
_121
"list_picker": {
_121
"text": "string",
_121
"button_text": "string",
_121
"list_items": [
_121
{
_121
"id": "string",
_121
"title": "string",
_121
"subtitle": "string"
_121
}
_121
]
_121
},
_121
"quick_reply": {
_121
"text": "string",
_121
"reply_items": [
_121
{
_121
"id": "string",
_121
"title": "string"
_121
}
_121
]
_121
},
_121
"call_to_action": {
_121
"text": "string",
_121
"actions": [
_121
{
_121
"type": "url",
_121
"title": "string",
_121
"url": "string"
_121
}
_121
]
_121
},
_121
"card": {
_121
"title": "string",
_121
"subtitle": "string",
_121
"actions": [
_121
{
_121
"type": "phone_number",
_121
"title": "string",
_121
"phone_number": "string"
_121
}
_121
]
_121
}
_121
},
_121
"from": {
_121
"address": "string",
_121
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_121
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_121
},
_121
"to": [
_121
{
_121
"address": "string",
_121
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_121
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_121
}
_121
],
_121
"related": [
_121
{
_121
"id": "string",
_121
"uri": "string"
_121
}
_121
],
_121
"tags": {},
_121
"delivery_status": {
_121
"total_count": 245367,
_121
"queued": {
_121
"count": 432148
_121
},
_121
"sent": {
_121
"count": 752135
_121
},
_121
"delivered": {
_121
"count": 829603
_121
},
_121
"read": {
_121
"count": 379034
_121
},
_121
"opened": {
_121
"count": 96549
_121
},
_121
"undelivered": {
_121
"count": 256139
_121
},
_121
"failed": {
_121
"count": 591935
_121
}
_121
},
_121
"created_at": "2023-06-07T05:15:22.936Z",
_121
"updated_at": "2022-11-27T13:15:01.675Z",
_121
"deleted_at": "2023-06-19T18:37:51.483Z"
_121
}
_121
]
_121
}


Messages

List Messages

This operation fetches a paginated list of Messages.

Parameters

TypeScript
request: operations.ListMessagesRequest

The request object to use for the request.

Show child properties
operationId?: string

Filter Messages by Operation Id.


Example: operation_01h9krwprkeee8fzqspvwy6nq8


conversationId?: string

Filter Messages by Conversation Id.


Example: conversation_01h9krwprkeee8fzqspvwy6nq8


startDate?: Date

Filter to Messages created after the specified date and time.


endDate?: Date

Filter to Messages created before the specified date and time.


toContact?: string

Filter Messages by the Contact Id of the recipient.


Example: 01h9krwprkeee8fzqspvwy6nq8


fromContact?: string

Filter Messages by the Contact Id of the sender.


Example: 01h9krwprkeee8fzqspvwy6nq8


fromAddress?: string

Filter Messages sent from an address.


toAddress?: string

Filter Messages sent to an address.


channel?: components.MessageChannel

Filter Messages by channel.


Example: tel

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListMessagesResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listMessagesResponse?: operations.ListMessagesListMessagesResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListMessages.ts

_24
import { TwillioSDKDocs } from "Twilio-Communications-API";
_24
import { MessageChannel } from "Twilio-Communications-API/models/components";
_24
_24
async function run() {
_24
const sdk = new TwillioSDKDocs({
_24
security: {
_24
username: "<YOUR_USERNAME_HERE>",
_24
password: "<YOUR_PASSWORD_HERE>",
_24
},
_24
});
_24
_24
const result = await sdk.messages.listMessages({
_24
operationId: "operation_01h9krwprkeee8fzqspvwy6nq8",
_24
conversationId: "conversation_01h9krwprkeee8fzqspvwy6nq8",
_24
toContact: "01h9krwprkeee8fzqspvwy6nq8",
_24
fromContact: "01h9krwprkeee8fzqspvwy6nq8",
_24
channel: MessageChannel.Tel,
_24
});
_24
_24
// Handle the result
_24
console.log(result)
_24
}
_24
_24
run();

Example Response

_154
{
_154
"operation": {
_154
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_154
"delivery": {
_154
"total_count": 262118,
_154
"queued": {
_154
"count": 458515
_154
},
_154
"sent": {
_154
"count": 524593
_154
},
_154
"delivered": {
_154
"count": 442015
_154
},
_154
"read": {
_154
"count": 852635
_154
},
_154
"opened": {
_154
"count": 433439
_154
},
_154
"undelivered": {
_154
"count": 826871
_154
},
_154
"failed": {
_154
"count": 509342
_154
}
_154
}
_154
},
_154
"messages": [
_154
{
_154
"id": "message_01h9krwprkeee8fzqspvwy6nq8",
_154
"content": {
_154
"text": "string",
_154
"media": [
_154
{
_154
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_154
"file_name": "string",
_154
"file_size": 568.48,
_154
"mime_type": "text/plain",
_154
"content_reference": {
_154
"temporary_url": "https://rewarding-copy.net",
_154
"expires_at": "2024-07-17T14:43:47.752Z"
_154
},
_154
"tags": {},
_154
"created_by": {
_154
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8"
_154
},
_154
"updated_at": "2024-01-17T18:28:14.327Z",
_154
"created_at": "2022-10-12T07:51:04.194Z",
_154
"deleted_at": "2022-07-15T11:46:29.520Z"
_154
}
_154
],
_154
"location": {
_154
"title": "string",
_154
"latitude": 3738.13,
_154
"longitude": 698.59
_154
},
_154
"list_picker": {
_154
"text": "string",
_154
"button_text": "string",
_154
"list_items": [
_154
{
_154
"id": "string",
_154
"title": "string",
_154
"subtitle": "string"
_154
}
_154
]
_154
},
_154
"quick_reply": {
_154
"text": "string",
_154
"reply_items": [
_154
{
_154
"id": "string",
_154
"title": "string"
_154
}
_154
]
_154
},
_154
"call_to_action": {
_154
"text": "string",
_154
"actions": [
_154
{
_154
"type": "phone_number",
_154
"title": "string",
_154
"phone_number": "string"
_154
}
_154
]
_154
},
_154
"card": {
_154
"title": "string",
_154
"subtitle": "string",
_154
"actions": [
_154
{
_154
"type": "url",
_154
"title": "string",
_154
"url": "string"
_154
}
_154
]
_154
}
_154
},
_154
"from": {
_154
"address": "string",
_154
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_154
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_154
},
_154
"to": [
_154
{
_154
"address": "string",
_154
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_154
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_154
}
_154
],
_154
"related": [
_154
{
_154
"id": "string",
_154
"uri": "string"
_154
}
_154
],
_154
"tags": {},
_154
"delivery_status": {
_154
"total_count": 133465,
_154
"queued": {
_154
"count": 197054
_154
},
_154
"sent": {
_154
"count": 459856
_154
},
_154
"delivered": {
_154
"count": 44612
_154
},
_154
"read": {
_154
"count": 799796
_154
},
_154
"opened": {
_154
"count": 76956
_154
},
_154
"undelivered": {
_154
"count": 518835
_154
},
_154
"failed": {
_154
"count": 306810
_154
}
_154
},
_154
"created_at": "2023-09-25T23:41:23.030Z",
_154
"updated_at": "2023-03-31T08:46:58.589Z",
_154
"deleted_at": "2024-11-17T12:56:04.847Z"
_154
}
_154
],
_154
"pagination": {
_154
"page": 174112,
_154
"prev": "string",
_154
"next": "string",
_154
"self": "string"
_154
}
_154
}


Messages

Fetch One Message

This operation fetches a single Message using its id.

Parameters

TypeScript
messageId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneMessageResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


message?: components.Message

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneMessage.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const messageId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.messages.fetchOneMessage(messageId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_117
{
_117
"id": "message_01h9krwprkeee8fzqspvwy6nq8",
_117
"content": {
_117
"text": "string",
_117
"media": [
_117
{
_117
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_117
"file_name": "string",
_117
"file_size": 4752.89,
_117
"mime_type": "text/plain",
_117
"content_reference": {
_117
"temporary_url": "http://sparkling-hog.name",
_117
"expires_at": "2023-07-13T23:28:59.906Z"
_117
},
_117
"tags": {},
_117
"created_by": {
_117
"address": "string"
_117
},
_117
"updated_at": "2022-06-07T15:17:15.644Z",
_117
"created_at": "2024-01-17T19:20:55.093Z",
_117
"deleted_at": "2023-12-13T19:28:32.107Z"
_117
}
_117
],
_117
"location": {
_117
"title": "string",
_117
"latitude": 2775.96,
_117
"longitude": 5392.24
_117
},
_117
"list_picker": {
_117
"text": "string",
_117
"button_text": "string",
_117
"list_items": [
_117
{
_117
"id": "string",
_117
"title": "string",
_117
"subtitle": "string"
_117
}
_117
]
_117
},
_117
"quick_reply": {
_117
"text": "string",
_117
"reply_items": [
_117
{
_117
"id": "string",
_117
"title": "string"
_117
}
_117
]
_117
},
_117
"call_to_action": {
_117
"text": "string",
_117
"actions": [
_117
{
_117
"type": "url",
_117
"title": "string",
_117
"url": "string"
_117
}
_117
]
_117
},
_117
"card": {
_117
"title": "string",
_117
"subtitle": "string",
_117
"actions": [
_117
{
_117
"type": "url",
_117
"title": "string",
_117
"url": "string"
_117
}
_117
]
_117
}
_117
},
_117
"from": {
_117
"address": "string",
_117
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_117
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_117
},
_117
"to": [
_117
{
_117
"address": "string",
_117
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_117
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_117
}
_117
],
_117
"related": [
_117
{
_117
"id": "string",
_117
"uri": "string"
_117
}
_117
],
_117
"tags": {},
_117
"delivery_status": {
_117
"total_count": 159870,
_117
"queued": {
_117
"count": 187131
_117
},
_117
"sent": {
_117
"count": 903984
_117
},
_117
"delivered": {
_117
"count": 543806
_117
},
_117
"read": {
_117
"count": 456911
_117
},
_117
"opened": {
_117
"count": 882042
_117
},
_117
"undelivered": {
_117
"count": 458604
_117
},
_117
"failed": {
_117
"count": 724168
_117
}
_117
},
_117
"created_at": "2023-03-14T07:57:43.931Z",
_117
"updated_at": "2022-04-13T10:21:26.999Z",
_117
"deleted_at": "2024-09-17T19:59:01.544Z"
_117
}


Messages

Delete Message

This operation deletes a Message

Parameters

TypeScript
messageId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeleteMessageResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeleteMessage.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const messageId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.messages.deleteMessage(messageId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 426306,
_10
"message": "string",
_10
"more_info": "https://kooky-propaganda.name"
_10
}


Messages

List Message Operations

This operation fetches a paginated list of Message Operations.

Parameters

TypeScript
startDate?: Date

Filter to Operations created after the specified date and time.


endDate?: Date

Filter to Operations created before the specified date and time.


status?: components.MessageOperationStatus

Filter to Operations with the specified status.

Show child properties
NameValue
processingprocessing
completedcompleted
canceledcanceled
failedfailed

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListMessageOperationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listMessageOperationsResponse?: operations.ListMessageOperationsListMessageOperationsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListMessageOperations.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
import { MessageOperationStatus } from "Twilio-Communications-API/models/components";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const startDate = new Date("2022-11-23T02:21:00.924Z");
_22
const endDate = new Date("2024-09-04T09:11:49.338Z");
_22
const status = MessageOperationStatus.Processing;
_22
_22
const result = await sdk.messages.listMessageOperations(startDate, endDate, status);
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_39
{
_39
"operations": [
_39
{
_39
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_39
"delivery": {
_39
"total_count": 716244,
_39
"queued": {
_39
"count": 756779
_39
},
_39
"sent": {
_39
"count": 636061
_39
},
_39
"delivered": {
_39
"count": 240020
_39
},
_39
"read": {
_39
"count": 160538
_39
},
_39
"opened": {
_39
"count": 796392
_39
},
_39
"undelivered": {
_39
"count": 959167
_39
},
_39
"failed": {
_39
"count": 458139
_39
}
_39
},
_39
"created_at": "2023-10-10T17:14:50.735Z",
_39
"updated_at": "2024-11-11T06:41:13.966Z"
_39
}
_39
],
_39
"pagination": {
_39
"page": 857723,
_39
"prev": "string",
_39
"next": "string",
_39
"self": "string"
_39
}
_39
}


Messages

Fetch One Message Operation

This operation fetches a single Message Operation using its id.

Parameters

TypeScript
operationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneMessageOperationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


messageOperation?: components.MessageOperation

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneMessageOperation.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const operationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.messages.fetchOneMessageOperation(operationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_29
{
_29
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_29
"delivery": {
_29
"total_count": 457223,
_29
"queued": {
_29
"count": 97468
_29
},
_29
"sent": {
_29
"count": 621679
_29
},
_29
"delivered": {
_29
"count": 863023
_29
},
_29
"read": {
_29
"count": 157632
_29
},
_29
"opened": {
_29
"count": 992430
_29
},
_29
"undelivered": {
_29
"count": 85001
_29
},
_29
"failed": {
_29
"count": 94458
_29
}
_29
},
_29
"created_at": "2023-11-26T10:25:18.758Z",
_29
"updated_at": "2023-03-13T16:24:53.073Z"
_29
}


Messages

Cancel Message Operation

This operation cancels a Message Operation using its id.

Parameters

TypeScript
operationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CancelMessageOperationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


messageOperation?: components.MessageOperation

OK

Show child properties

headers: Record<string, *string*[]>
CancelMessageOperation.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const operationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.messages.cancelMessageOperation(operationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_29
{
_29
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_29
"delivery": {
_29
"total_count": 62713,
_29
"queued": {
_29
"count": 936747
_29
},
_29
"sent": {
_29
"count": 447378
_29
},
_29
"delivered": {
_29
"count": 727697
_29
},
_29
"read": {
_29
"count": 742238
_29
},
_29
"opened": {
_29
"count": 306986
_29
},
_29
"undelivered": {
_29
"count": 119771
_29
},
_29
"failed": {
_29
"count": 443879
_29
}
_29
},
_29
"created_at": "2023-03-06T09:13:54.436Z",
_29
"updated_at": "2022-01-18T21:30:17.962Z"
_29
}


Push Notifications

*Use PushNotifications to send push notifications to your mobile apps via Firebase Cloud Messaging and Apple Push Notification services as well as other push-enabled services.*

Available Operations


Push Notifications

Send Push Notifications

This operation creates and sends out push notifications to the specified recipients.

Parameters

TypeScript
request: operations.SendPushNotificationsSendPushNotificationsRequest

The request object to use for the request.

Show child properties
to: *operations.SendPushNotificationsRecipient*[]

A list of recipients to send the push notifications(s) to.


content: operations.SendPushNotificationsContent

The content of the Push Notification. - Use PushNotificationContent to construct the content of your Push Notification. - Use PushNotificationContentOTP to send a PushNotification with an OTP to Verify your recipient. - Use PushNotificationContentTemplate to reference a stored Content template.


priority?: components.PushNotificationPriority

The priority of the Push Notification. A value of "low" reduces the client app battery consumption. A value of "high" sends the notification immediately and can wake up a sleeping device.

Show child properties

sound?: string

The name of the sound to be played for the push notification.


timeToDeliver?: components.PushNotificationTimeToDeliver

How long the notification delivery is attempted.


processingOptions?: operations.SendPushNotificationsRequestProcessingOptions

Additional options to control how the Push Notification is processed.

Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.SendPushNotificationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


sendPushNotificationsResponse?: operations.SendPushNotificationsSendPushNotificationsResponse

Created

Show child properties

headers: Record<string, *string*[]>
SendPushNotifications.ts

_28
import { TwillioSDKDocs } from "Twilio-Communications-API";
_28
import { PushNotificationPriority } from "Twilio-Communications-API/models/components";
_28
_28
async function run() {
_28
const sdk = new TwillioSDKDocs({
_28
security: {
_28
username: "<YOUR_USERNAME_HERE>",
_28
password: "<YOUR_PASSWORD_HERE>",
_28
},
_28
});
_28
_28
const result = await sdk.pushNotifications.sendPushNotifications({
_28
to: [
_28
,
_28
],
_28
processingOptions: {
_28
recipientPreferenceManagement: {},
_28
},
_28
tags: {
_28
"key": {},
_28
},
_28
});
_28
_28
// Handle the result
_28
console.log(result)
_28
}
_28
_28
run();

Example Response

_81
{
_81
"push_notifications": [
_81
{
_81
"id": "pushnotification_01h9krwprkeee8fzqspvwy6nq8",
_81
"to": [
_81
{
_81
"address": "string",
_81
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8"
_81
}
_81
],
_81
"content": {
_81
"title": "string",
_81
"text": "string",
_81
"click_action": {
_81
"url": "http://terrific-grief.name",
_81
"activity": "string"
_81
},
_81
"channel_passthrough": [
_81
{
_81
"data": {}
_81
}
_81
],
_81
"icon": "string",
_81
"default_variables": {},
_81
"media": {
_81
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_81
"file_name": "string",
_81
"file_size": 996.15,
_81
"mime_type": "text/plain",
_81
"content_reference": {
_81
"temporary_url": "https://watchful-boudoir.org",
_81
"expires_at": "2022-04-11T20:41:36.792Z"
_81
},
_81
"tags": {},
_81
"created_by": {
_81
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_81
},
_81
"updated_at": "2022-03-03T08:07:30.724Z",
_81
"created_at": "2022-12-25T01:32:24.446Z",
_81
"deleted_at": "2022-04-05T20:09:02.208Z"
_81
}
_81
},
_81
"sound": "string",
_81
"time_to_deliver": "2023-09-03T22:35:07Z",
_81
"related": [
_81
{
_81
"id": "string",
_81
"uri": "string"
_81
}
_81
],
_81
"tags": {},
_81
"delivery_status": {
_81
"total_count": 33074,
_81
"queued": {
_81
"count": 522371
_81
},
_81
"sent": {
_81
"count": 513075
_81
},
_81
"delivered": {
_81
"count": 649832
_81
},
_81
"read": {
_81
"count": 544591
_81
},
_81
"opened": {
_81
"count": 32465
_81
},
_81
"undelivered": {
_81
"count": 580152
_81
},
_81
"failed": {
_81
"count": 771089
_81
}
_81
},
_81
"created_at": "2023-02-17T08:15:50.390Z",
_81
"updated_at": "2022-01-14T04:36:02.933Z",
_81
"deleted_at": "2023-06-23T03:54:53.209Z"
_81
}
_81
]
_81
}


Push Notifications

List Push Notifications

This operation fetches a paginated list of Push Notifications.

Parameters

TypeScript
request: operations.ListPushNotificationsRequest

The request object to use for the request.

Show child properties
operationId?: string

Filter Push Notifications by Operation Id.


Example: operation_01h9krwprkeee8fzqspvwy6nq8


conversationId?: string

Filter Push Notifications by Conversation Id.


Example: conversation_01h9krwprkeee8fzqspvwy6nq8


startDate?: Date

Filter to Push Notifications created after the specified date and time.


endDate?: Date

Filter to Push Notifications created before the specified date and time.


toContact?: string

Filter Push Notifications sent to a specific Contact.


Example: contact_01h9krwprkeee8fzqspvwy6nq8


toAddress?: string

Filter Push Notifications sent to an address.


channel?: components.PushNotificationChannel

Filter Push Notifications by channel.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListPushNotificationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listPushNotificationsResponse?: operations.ListPushNotificationsListPushNotificationsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListPushNotifications.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
import { PushNotificationChannel } from "Twilio-Communications-API/models/components";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const result = await sdk.pushNotifications.listPushNotifications({
_22
operationId: "operation_01h9krwprkeee8fzqspvwy6nq8",
_22
conversationId: "conversation_01h9krwprkeee8fzqspvwy6nq8",
_22
toContact: "contact_01h9krwprkeee8fzqspvwy6nq8",
_22
});
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_87
{
_87
"push_notifications": [
_87
{
_87
"id": "pushnotification_01h9krwprkeee8fzqspvwy6nq8",
_87
"to": [
_87
{
_87
"address": "string",
_87
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8"
_87
}
_87
],
_87
"content": {
_87
"title": "string",
_87
"text": "string",
_87
"click_action": {
_87
"url": "https://personal-decongestant.org",
_87
"activity": "string"
_87
},
_87
"channel_passthrough": [
_87
{
_87
"data": {}
_87
}
_87
],
_87
"icon": "string",
_87
"default_variables": {},
_87
"media": {
_87
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_87
"file_name": "string",
_87
"file_size": 456.59,
_87
"mime_type": "text/plain",
_87
"content_reference": {
_87
"temporary_url": "http://friendly-circumstance.net",
_87
"expires_at": "2023-12-02T01:59:21.096Z"
_87
},
_87
"tags": {},
_87
"created_by": {
_87
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8"
_87
},
_87
"updated_at": "2023-06-22T08:59:30.267Z",
_87
"created_at": "2023-12-03T11:11:43.357Z",
_87
"deleted_at": "2024-12-20T09:26:04.977Z"
_87
}
_87
},
_87
"sound": "string",
_87
"time_to_deliver": "PT10M",
_87
"related": [
_87
{
_87
"id": "string",
_87
"uri": "string"
_87
}
_87
],
_87
"tags": {},
_87
"delivery_status": {
_87
"total_count": 801836,
_87
"queued": {
_87
"count": 288398
_87
},
_87
"sent": {
_87
"count": 241418
_87
},
_87
"delivered": {
_87
"count": 662505
_87
},
_87
"read": {
_87
"count": 246063
_87
},
_87
"opened": {
_87
"count": 665859
_87
},
_87
"undelivered": {
_87
"count": 517309
_87
},
_87
"failed": {
_87
"count": 424089
_87
}
_87
},
_87
"created_at": "2023-08-31T22:30:29.478Z",
_87
"updated_at": "2023-04-14T21:45:20.196Z",
_87
"deleted_at": "2022-11-11T14:36:11.419Z"
_87
}
_87
],
_87
"pagination": {
_87
"page": 822560,
_87
"prev": "string",
_87
"next": "string",
_87
"self": "string"
_87
}
_87
}


Push Notifications

Fetch One Push Notification

This operation fetches a single Push Notification using its id.

Parameters

TypeScript
pushNotificationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOnePushNotificationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


pushNotification?: components.PushNotification

OK

Show child properties

headers: Record<string, *string*[]>
FetchOnePushNotification.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const pushNotificationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.pushNotifications.fetchOnePushNotification(pushNotificationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_77
{
_77
"id": "pushnotification_01h9krwprkeee8fzqspvwy6nq8",
_77
"to": [
_77
{
_77
"address": "string",
_77
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8"
_77
}
_77
],
_77
"content": {
_77
"title": "string",
_77
"text": "string",
_77
"click_action": {
_77
"url": "https://immense-icing.info",
_77
"activity": "string"
_77
},
_77
"channel_passthrough": [
_77
{
_77
"data": {}
_77
}
_77
],
_77
"icon": "string",
_77
"default_variables": {},
_77
"media": {
_77
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_77
"file_name": "string",
_77
"file_size": 3631.61,
_77
"mime_type": "text/plain",
_77
"content_reference": {
_77
"temporary_url": "https://hungry-aspect.net",
_77
"expires_at": "2022-09-12T23:01:13.303Z"
_77
},
_77
"tags": {},
_77
"created_by": {
_77
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_77
},
_77
"updated_at": "2023-01-17T23:27:12.009Z",
_77
"created_at": "2024-10-24T06:19:40.469Z",
_77
"deleted_at": "2024-06-12T04:52:41.978Z"
_77
}
_77
},
_77
"sound": "string",
_77
"time_to_deliver": 600,
_77
"related": [
_77
{
_77
"id": "string",
_77
"uri": "string"
_77
}
_77
],
_77
"tags": {},
_77
"delivery_status": {
_77
"total_count": 968972,
_77
"queued": {
_77
"count": 697142
_77
},
_77
"sent": {
_77
"count": 897071
_77
},
_77
"delivered": {
_77
"count": 121059
_77
},
_77
"read": {
_77
"count": 241545
_77
},
_77
"opened": {
_77
"count": 228263
_77
},
_77
"undelivered": {
_77
"count": 489509
_77
},
_77
"failed": {
_77
"count": 891523
_77
}
_77
},
_77
"created_at": "2023-01-28T11:39:32.490Z",
_77
"updated_at": "2024-01-26T23:39:52.038Z",
_77
"deleted_at": "2023-02-27T05:17:06.651Z"
_77
}


Push Notifications

Delete Push Notification

This operation deletes a Push Notification

Parameters

TypeScript
pushNotificationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeletePushNotificationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeletePushNotification.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const pushNotificationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.pushNotifications.deletePushNotification(pushNotificationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 58356,
_10
"message": "string",
_10
"more_info": "https://self-assured-bull.org"
_10
}


Push Notifications

List Push Notification Operations

This operation fetches a paginated list of Push Notification Operations.

Parameters

TypeScript
startDate?: Date

Filter to Operations created after the specified date and time.


endDate?: Date

Filter to Operations created before the specified date and time.


status?: components.PushNotificationOperationStatus

Filter to Operations with the specified status.

Show child properties
NameValue
processingprocessing
completedcompleted
canceledcanceled
failedfailed

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListPushNotificationOperationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listPushNotificationOperationsResponse?: operations.ListPushNotificationOperationsListPushNotificationOperationsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListPushNotificationOperations.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
import { PushNotificationOperationStatus } from "Twilio-Communications-API/models/components";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const startDate = new Date("2024-11-22T04:11:07.245Z");
_22
const endDate = new Date("2022-10-26T19:57:04.215Z");
_22
const status = PushNotificationOperationStatus.Completed;
_22
_22
const result = await sdk.pushNotifications.listPushNotificationOperations(startDate, endDate, status);
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_39
{
_39
"operations": [
_39
{
_39
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_39
"delivery": {
_39
"total_count": 272437,
_39
"queued": {
_39
"count": 132815
_39
},
_39
"sent": {
_39
"count": 374244
_39
},
_39
"delivered": {
_39
"count": 324405
_39
},
_39
"read": {
_39
"count": 680116
_39
},
_39
"opened": {
_39
"count": 795535
_39
},
_39
"undelivered": {
_39
"count": 503934
_39
},
_39
"failed": {
_39
"count": 296242
_39
}
_39
},
_39
"created_at": "2024-08-29T00:21:05.159Z",
_39
"updated_at": "2024-07-08T18:01:50.281Z"
_39
}
_39
],
_39
"pagination": {
_39
"page": 351870,
_39
"prev": "string",
_39
"next": "string",
_39
"self": "string"
_39
}
_39
}


Push Notifications

Fetch One Push Notification Operation

This operation fetches a single Push Notification Operation using its id.

Parameters

TypeScript
operationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOnePushNotificationOperationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


pushNotificationOperation?: components.PushNotificationOperation

OK

Show child properties

headers: Record<string, *string*[]>
FetchOnePushNotificationOperation.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const operationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.pushNotifications.fetchOnePushNotificationOperation(operationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_29
{
_29
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_29
"delivery": {
_29
"total_count": 738391,
_29
"queued": {
_29
"count": 502389
_29
},
_29
"sent": {
_29
"count": 942584
_29
},
_29
"delivered": {
_29
"count": 633998
_29
},
_29
"read": {
_29
"count": 867290
_29
},
_29
"opened": {
_29
"count": 940210
_29
},
_29
"undelivered": {
_29
"count": 750765
_29
},
_29
"failed": {
_29
"count": 699575
_29
}
_29
},
_29
"created_at": "2024-11-26T21:21:58.965Z",
_29
"updated_at": "2022-05-25T12:14:09.382Z"
_29
}


Push Notifications

Cancel Push Notification Operation

This operation cancels a Push Notification Operation using its id.

Parameters

TypeScript
operationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CancelPushNotificationOperationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


pushNotificationOperation?: components.PushNotificationOperation

OK

Show child properties

headers: Record<string, *string*[]>
CancelPushNotificationOperation.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const operationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.pushNotifications.cancelPushNotificationOperation(operationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_29
{
_29
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_29
"delivery": {
_29
"total_count": 707918,
_29
"queued": {
_29
"count": 451822
_29
},
_29
"sent": {
_29
"count": 70869
_29
},
_29
"delivered": {
_29
"count": 292794
_29
},
_29
"read": {
_29
"count": 152354
_29
},
_29
"opened": {
_29
"count": 417486
_29
},
_29
"undelivered": {
_29
"count": 131289
_29
},
_29
"failed": {
_29
"count": 604118
_29
}
_29
},
_29
"created_at": "2023-02-24T13:22:59.417Z",
_29
"updated_at": "2024-11-18T10:35:39.874Z"
_29
}


Communications

*Use Communications to send and receive 1:1 omni-channel communications across all channels of all communication types. Reach each and every customer with personalized content, on the right channel, at the optimal time, at scale. Just send it!*

Available Operations


Communications

Send Communications

This operation sends omni-channel communications to audiences across all channels. This operation can also be used to directly send Messages, Emails, and Push Notifications.

Parameters

TypeScript
request: operations.SendCommunicationsSendCommunicationsRequest

The request object to use for the request.

Show child properties
from?: operations.SendCommunicationsRequestFrom

The sending identity to associate with the Communication(s). To send across multiple channels, use an AgentAddressee.


to: *operations.SendCommunicationsRequestRecipient*[]

A list of recipients to send the Communication(s) to.


content: operations.SendCommunicationsContent

The content of the communication - including text, media, body (MIMEs), and content transformation options.


processingOptions?: components.ProcessingOptions

Optional processing directives, specific to the related resources to be created.

Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.SendCommunicationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


sendCommunicationsResponse?: operations.SendCommunicationsSendCommunicationsResponse

Created

Show child properties

headers: Record<string, *string*[]>
SendCommunications.ts

_41
import { TwillioSDKDocs } from "Twilio-Communications-API";
_41
import { PushNotificationPriority } from "Twilio-Communications-API/models/components";
_41
_41
async function run() {
_41
const sdk = new TwillioSDKDocs({
_41
security: {
_41
username: "<YOUR_USERNAME_HERE>",
_41
password: "<YOUR_PASSWORD_HERE>",
_41
},
_41
});
_41
_41
const result = await sdk.communications.sendCommunications({
_41
to: [
_41
,
_41
],
_41
processingOptions: {
_41
usePreference: {},
_41
messages: {},
_41
emails: {
_41
replyTo: [
_41
,
_41
],
_41
cc: [
_41
,
_41
],
_41
bcc: [
_41
,
_41
],
_41
},
_41
pushNotifications: {},
_41
},
_41
tags: {
_41
"key": {},
_41
},
_41
});
_41
_41
// Handle the result
_41
console.log(result)
_41
}
_41
_41
run();

Example Response

_123
{
_123
"communications": [
_123
{
_123
"id": "communication_01h9krwprkeee8fzqspvwy6nq8",
_123
"from": {
_123
"address": "string",
_123
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_123
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_123
},
_123
"to": [
_123
{
_123
"address": "string",
_123
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_123
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_123
}
_123
],
_123
"content": {
_123
"text": "string",
_123
"html": "string",
_123
"title": "string",
_123
"media": [
_123
{
_123
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_123
"file_name": "string",
_123
"file_size": 193,
_123
"mime_type": "text/plain",
_123
"content_reference": {
_123
"temporary_url": "https://wooden-documentary.com",
_123
"expires_at": "2023-10-12T02:01:44.094Z"
_123
},
_123
"tags": {},
_123
"created_by": {
_123
"address": "string"
_123
},
_123
"updated_at": "2022-08-25T05:16:11.780Z",
_123
"created_at": "2023-03-22T18:42:49.757Z",
_123
"deleted_at": "2023-09-28T14:00:56.803Z"
_123
}
_123
],
_123
"location": {
_123
"title": "string",
_123
"latitude": 5520.78,
_123
"longitude": 9757.52
_123
},
_123
"list_picker": {
_123
"text": "string",
_123
"button_text": "string",
_123
"list_items": [
_123
{
_123
"id": "string",
_123
"title": "string",
_123
"subtitle": "string"
_123
}
_123
]
_123
},
_123
"quick_reply": {
_123
"text": "string",
_123
"reply_items": [
_123
{
_123
"id": "string",
_123
"title": "string"
_123
}
_123
]
_123
},
_123
"call_to_action": {
_123
"text": "string",
_123
"actions": [
_123
{
_123
"type": "url",
_123
"title": "string",
_123
"url": "string"
_123
}
_123
]
_123
},
_123
"card": {
_123
"title": "string",
_123
"subtitle": "string",
_123
"actions": [
_123
{
_123
"type": "url",
_123
"title": "string",
_123
"url": "string"
_123
}
_123
]
_123
}
_123
},
_123
"delivery_status": {
_123
"total_count": 970076,
_123
"queued": {
_123
"count": 401713
_123
},
_123
"sent": {
_123
"count": 248413
_123
},
_123
"delivered": {
_123
"count": 505866
_123
},
_123
"read": {
_123
"count": 310381
_123
},
_123
"opened": {
_123
"count": 373035
_123
},
_123
"undelivered": {
_123
"count": 524970
_123
},
_123
"failed": {
_123
"count": 750595
_123
}
_123
},
_123
"related": [
_123
{
_123
"id": "string",
_123
"uri": "string"
_123
}
_123
],
_123
"tags": {},
_123
"created_at": "2024-10-09T21:04:19.713Z",
_123
"updated_at": "2024-11-25T23:09:14.590Z",
_123
"deleted_at": "2024-08-03T02:25:37.503Z"
_123
}
_123
]
_123
}


Communications

List Communications

This operation fetches a paginated list of Communications.

Parameters

TypeScript
request: operations.ListCommunicationsRequest

The request object to use for the request.

Show child properties
operationId?: string

Filter to Communications created in a specific Operation.


Example: operation_01h9krwprkeee8fzqspvwy6nq8


conversationId?: string

Filter to Communications created in a specific Conversation.


Example: conversation_01h9krwprkeee8fzqspvwy6nq8


startDate?: Date

Filter to Communications created after the specified date and time.


endDate?: Date

Filter to Communications created before the specified date and time.


toContact?: string

Filter to Communications sent to a specific Contact.


Example: contact_01h9krwprkeee8fzqspvwy6nq8


toAddress?: string

Filter to Communications sent to a specific address.


channel?: components.CommunicationChannel

Filter to Communications that match a specific channel.

Show child properties

communicationType?: components.CommunicationType

Filter to Communications that match a specific type.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListCommunicationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listCommunicationsResponse?: operations.ListCommunicationsListCommunicationsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListCommunications.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
import { CommunicationChannel, CommunicationType } from "Twilio-Communications-API/models/components";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const result = await sdk.communications.listCommunications({
_22
operationId: "operation_01h9krwprkeee8fzqspvwy6nq8",
_22
conversationId: "conversation_01h9krwprkeee8fzqspvwy6nq8",
_22
toContact: "contact_01h9krwprkeee8fzqspvwy6nq8",
_22
});
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_130
{
_130
"communications": [
_130
{
_130
"id": "communication_01h9krwprkeee8fzqspvwy6nq8",
_130
"from": {
_130
"address": "string",
_130
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_130
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_130
},
_130
"to": [
_130
{
_130
"address": "string",
_130
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_130
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_130
}
_130
],
_130
"content": {
_130
"text": "string",
_130
"html": "string",
_130
"title": "string",
_130
"media": [
_130
{
_130
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_130
"file_name": "string",
_130
"file_size": 2536.42,
_130
"mime_type": "text/plain",
_130
"content_reference": {
_130
"temporary_url": "http://international-tax.com",
_130
"expires_at": "2023-07-16T15:31:42.506Z"
_130
},
_130
"tags": {},
_130
"created_by": {
_130
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_130
},
_130
"updated_at": "2023-07-14T15:34:57.575Z",
_130
"created_at": "2024-03-22T03:31:31.298Z",
_130
"deleted_at": "2023-02-28T23:06:04.973Z"
_130
}
_130
],
_130
"location": {
_130
"title": "string",
_130
"latitude": 6805.15,
_130
"longitude": 5300.89
_130
},
_130
"list_picker": {
_130
"text": "string",
_130
"button_text": "string",
_130
"list_items": [
_130
{
_130
"id": "string",
_130
"title": "string",
_130
"subtitle": "string"
_130
}
_130
]
_130
},
_130
"quick_reply": {
_130
"text": "string",
_130
"reply_items": [
_130
{
_130
"id": "string",
_130
"title": "string"
_130
}
_130
]
_130
},
_130
"call_to_action": {
_130
"text": "string",
_130
"actions": [
_130
{
_130
"type": "phone_number",
_130
"title": "string",
_130
"phone_number": "string"
_130
}
_130
]
_130
},
_130
"card": {
_130
"title": "string",
_130
"text": "string",
_130
"footer": "string",
_130
"actions": [
_130
{
_130
"type": "phone_number",
_130
"title": "string",
_130
"phone_number": "string"
_130
}
_130
]
_130
}
_130
},
_130
"delivery_status": {
_130
"total_count": 892863,
_130
"queued": {
_130
"count": 204923
_130
},
_130
"sent": {
_130
"count": 341698
_130
},
_130
"delivered": {
_130
"count": 676243
_130
},
_130
"read": {
_130
"count": 879235
_130
},
_130
"opened": {
_130
"count": 543678
_130
},
_130
"undelivered": {
_130
"count": 282699
_130
},
_130
"failed": {
_130
"count": 30235
_130
}
_130
},
_130
"related": [
_130
{
_130
"id": "string",
_130
"uri": "string"
_130
}
_130
],
_130
"tags": {},
_130
"created_at": "2022-01-09T15:23:00.369Z",
_130
"updated_at": "2023-05-20T09:37:09.099Z",
_130
"deleted_at": "2023-02-13T10:57:01.355Z"
_130
}
_130
],
_130
"pagination": {
_130
"page": 24527,
_130
"prev": "string",
_130
"next": "string",
_130
"self": "string"
_130
}
_130
}


Communications

Fetch Single Communication

This operation fetches a single Communication using its Id.

Parameters

TypeScript
communicationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchSingleCommunicationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


communication?: components.Communication

OK

Show child properties

headers: Record<string, *string*[]>
FetchSingleCommunication.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const communicationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.communications.fetchSingleCommunication(communicationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_119
{
_119
"id": "communication_01h9krwprkeee8fzqspvwy6nq8",
_119
"from": {
_119
"address": "string",
_119
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_119
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_119
},
_119
"to": [
_119
{
_119
"address": "string",
_119
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_119
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_119
}
_119
],
_119
"content": {
_119
"text": "string",
_119
"html": "string",
_119
"title": "string",
_119
"media": [
_119
{
_119
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_119
"file_name": "string",
_119
"file_size": 3611.51,
_119
"mime_type": "text/plain",
_119
"content_reference": {
_119
"temporary_url": "http://lovable-gumshoe.com",
_119
"expires_at": "2022-01-27T15:32:03.734Z"
_119
},
_119
"tags": {},
_119
"created_by": {
_119
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_119
},
_119
"updated_at": "2023-01-11T12:02:21.397Z",
_119
"created_at": "2024-09-20T03:56:38.766Z",
_119
"deleted_at": "2023-11-13T23:09:57.015Z"
_119
}
_119
],
_119
"location": {
_119
"title": "string",
_119
"latitude": 85.11,
_119
"longitude": 2790.68
_119
},
_119
"list_picker": {
_119
"text": "string",
_119
"button_text": "string",
_119
"list_items": [
_119
{
_119
"id": "string",
_119
"title": "string",
_119
"subtitle": "string"
_119
}
_119
]
_119
},
_119
"quick_reply": {
_119
"text": "string",
_119
"reply_items": [
_119
{
_119
"id": "string",
_119
"title": "string"
_119
}
_119
]
_119
},
_119
"call_to_action": {
_119
"text": "string",
_119
"actions": [
_119
{
_119
"type": "phone_number",
_119
"title": "string",
_119
"phone_number": "string"
_119
}
_119
]
_119
},
_119
"card": {
_119
"title": "string",
_119
"subtitle": "string",
_119
"actions": [
_119
{
_119
"type": "phone_number",
_119
"title": "string",
_119
"phone_number": "string"
_119
}
_119
]
_119
}
_119
},
_119
"delivery_status": {
_119
"total_count": 115703,
_119
"queued": {
_119
"count": 99416
_119
},
_119
"sent": {
_119
"count": 289776
_119
},
_119
"delivered": {
_119
"count": 539074
_119
},
_119
"read": {
_119
"count": 724148
_119
},
_119
"opened": {
_119
"count": 388867
_119
},
_119
"undelivered": {
_119
"count": 227084
_119
},
_119
"failed": {
_119
"count": 454860
_119
}
_119
},
_119
"related": [
_119
{
_119
"id": "string",
_119
"uri": "string"
_119
}
_119
],
_119
"tags": {},
_119
"created_at": "2024-07-02T20:45:17.382Z",
_119
"updated_at": "2024-11-21T04:42:37.240Z",
_119
"deleted_at": "2024-09-29T14:39:13.019Z"
_119
}


Communications

Delete Communication

This operation deletes a Communication

Parameters

TypeScript
communicationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeleteCommunicationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeleteCommunication.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const communicationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.communications.deleteCommunication(communicationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 16871,
_10
"message": "string",
_10
"more_info": "https://revolving-humidity.net"
_10
}


Communications

List Communication Operations

This operation fetches a paginated list of Communication Operations.

Parameters

TypeScript
startDate?: Date

Filter to Operations created after the specified date and time.


endDate?: Date

Filter to Operations created before the specified date and time.


status?: components.CommunicationOperationStatus

Filter to Operations with the specified status.

Show child properties
NameValue
processingprocessing
completedcompleted
canceledcanceled
failedfailed

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListCommunicationOperationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listCommunicationOperationsResponse?: operations.ListCommunicationOperationsListCommunicationOperationsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListCommunicationOperations.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
import { CommunicationOperationStatus } from "Twilio-Communications-API/models/components";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const startDate = new Date("2023-06-08T12:30:11.149Z");
_22
const endDate = new Date("2024-05-17T17:32:07.006Z");
_22
const status = CommunicationOperationStatus.Failed;
_22
_22
const result = await sdk.communications.listCommunicationOperations(startDate, endDate, status);
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_39
{
_39
"operations": [
_39
{
_39
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_39
"delivery": {
_39
"total_count": 509807,
_39
"queued": {
_39
"count": 648598
_39
},
_39
"sent": {
_39
"count": 29100
_39
},
_39
"delivered": {
_39
"count": 919532
_39
},
_39
"read": {
_39
"count": 542457
_39
},
_39
"opened": {
_39
"count": 991142
_39
},
_39
"undelivered": {
_39
"count": 383103
_39
},
_39
"failed": {
_39
"count": 806670
_39
}
_39
},
_39
"created_at": "2023-05-21T06:19:25.029Z",
_39
"updated_at": "2022-09-07T14:59:09.178Z"
_39
}
_39
],
_39
"pagination": {
_39
"page": 826825,
_39
"prev": "string",
_39
"next": "string",
_39
"self": "string"
_39
}
_39
}


Communications

Fetch One Communication Operation

This operation fetches a single Communication Operation using its id.

Parameters

TypeScript
operationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneCommunicationOperationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


communicationOperation?: components.CommunicationOperation

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneCommunicationOperation.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const operationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.communications.fetchOneCommunicationOperation(operationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_29
{
_29
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_29
"delivery": {
_29
"total_count": 539118,
_29
"queued": {
_29
"count": 623295
_29
},
_29
"sent": {
_29
"count": 886961
_29
},
_29
"delivered": {
_29
"count": 618826
_29
},
_29
"read": {
_29
"count": 133461
_29
},
_29
"opened": {
_29
"count": 980581
_29
},
_29
"undelivered": {
_29
"count": 871786
_29
},
_29
"failed": {
_29
"count": 502721
_29
}
_29
},
_29
"created_at": "2024-10-07T21:26:28.566Z",
_29
"updated_at": "2023-08-18T04:10:23.565Z"
_29
}


Communications

Cancel Communication Operation

This operation cancels an Communication Operation using its Id.

Parameters

TypeScript
operationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CancelCommunicationOperationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


communicationOperation?: components.CommunicationOperation

OK

Show child properties

headers: Record<string, *string*[]>
CancelCommunicationOperation.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const operationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.communications.cancelCommunicationOperation(operationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_29
{
_29
"id": "operation_01h9krwprkeee8fzqspvwy6nq8",
_29
"delivery": {
_29
"total_count": 120919,
_29
"queued": {
_29
"count": 923306
_29
},
_29
"sent": {
_29
"count": 829898
_29
},
_29
"delivered": {
_29
"count": 968287
_29
},
_29
"read": {
_29
"count": 919783
_29
},
_29
"opened": {
_29
"count": 36033
_29
},
_29
"undelivered": {
_29
"count": 174772
_29
},
_29
"failed": {
_29
"count": 389135
_29
}
_29
},
_29
"created_at": "2024-11-09T13:09:41.589Z",
_29
"updated_at": "2023-09-09T19:26:50.272Z"
_29
}


Agents And Agent Pools

*Use Agents to build the sending and receiving identities that represent your business & applications.* - For 'outbound' communications, it is used as the sender of the commmunication (from field). - For 'inbound' communications to your app (sent by a Contact/end-user), it is used as the recipient (to field). - Use AgentPools to organize your Agents into logical groups to build omni-channel identities with multiple types of communications addresses (phone numbers, short codes, email addresses).

Available Operations


Agents & Agent Pools

Create Agent

This operation creates an Agent.

Parameters

TypeScript
request: operations.CreateAgentCreateAgent

The request object to use for the request.

Show child properties
id?: string

A reference to an Agent.


Example: agent_01h9krwprkeee8fzqspvwy6nq8


firstName?: string

The first_name of the Agent


lastName?: string

The last name of the Agent


displayName?: string

The name to associate with the address for sending and receiving communications, visible to external contacts for some types of communications like email.


address: string

The identifier within a channel address space for an actor (e.g. phone number)


channel: components.CommunicationChannel

The medium which a unit of communication is transmitted through. These are differentiated by a mix of transmission protocol, network controller/owner, endpoint and address model, as well as the model for content of the atomic unit of communication itself.

Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateAgentResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


agent?: components.Agent

Created

Show child properties

headers: Record<string, *string*[]>
CreateAgent.ts

_25
import { TwillioSDKDocs } from "Twilio-Communications-API";
_25
import { CommunicationChannel } from "Twilio-Communications-API/models/components";
_25
_25
async function run() {
_25
const sdk = new TwillioSDKDocs({
_25
security: {
_25
username: "<YOUR_USERNAME_HERE>",
_25
password: "<YOUR_PASSWORD_HERE>",
_25
},
_25
});
_25
_25
const result = await sdk.agentsAndAgentPools.createAgent({
_25
id: "agent_01h9krwprkeee8fzqspvwy6nq8",
_25
address: "4539 Bernier Green",
_25
channel: CommunicationChannel.Email,
_25
tags: {
_25
"key": {},
_25
},
_25
});
_25
_25
// Handle the result
_25
console.log(result)
_25
}
_25
_25
run();

Example Response

_11
{
_11
"id": "agent_01h9krwprkeee8fzqspvwy6nq8",
_11
"display_name": "string",
_11
"first_name": "string",
_11
"last_name": "string",
_11
"address": "string",
_11
"tags": {},
_11
"updated_at": "2024-09-20T08:44:30.297Z",
_11
"created_at": "2022-06-25T20:56:27.178Z",
_11
"deleted_at": "2023-09-28T19:07:55.588Z"
_11
}


Agents & Agent Pools

List Agents

This operation fetches a paginated list of Agents.

Parameters

TypeScript
channel?: components.CommunicationChannel

Filter to Representatives that match a specific channel.

Show child properties
NameValue
emailemail
teltel
whatsappwhatsapp
fbmfbm
gbmgbm
chatchat
apnapn
fcmfcm

startDate?: Date

Filter to Representatives created after the specified date and time.


endDate?: Date

Filter to Representatives created before the specified date and time.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListAgentsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listAgentsResponse?: operations.ListAgentsListAgentsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListAgents.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
import { CommunicationChannel } from "Twilio-Communications-API/models/components";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const channel = CommunicationChannel.Chat;
_22
const startDate = new Date("2022-01-23T03:49:29.173Z");
_22
const endDate = new Date("2023-02-08T14:13:31.435Z");
_22
_22
const result = await sdk.agentsAndAgentPools.listAgents(channel, startDate, endDate);
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_21
{
_21
"agents": [
_21
{
_21
"id": "agent_01h9krwprkeee8fzqspvwy6nq8",
_21
"display_name": "string",
_21
"first_name": "string",
_21
"last_name": "string",
_21
"address": "string",
_21
"tags": {},
_21
"updated_at": "2023-10-18T08:07:39.633Z",
_21
"created_at": "2023-05-05T05:57:31.258Z",
_21
"deleted_at": "2022-09-18T21:29:48.357Z"
_21
}
_21
],
_21
"pagination": {
_21
"page": 907876,
_21
"prev": "string",
_21
"next": "string",
_21
"self": "string"
_21
}
_21
}


Agents & Agent Pools

Fetch One Agent

This operation fetches a single Agent using its id.

Parameters

TypeScript
agentId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneAgentResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


agent?: components.Agent

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneAgent.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const agentId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.agentsAndAgentPools.fetchOneAgent(agentId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_11
{
_11
"id": "agent_01h9krwprkeee8fzqspvwy6nq8",
_11
"display_name": "string",
_11
"first_name": "string",
_11
"last_name": "string",
_11
"address": "string",
_11
"tags": {},
_11
"updated_at": "2022-06-25T14:42:08.428Z",
_11
"created_at": "2022-06-09T20:58:06.757Z",
_11
"deleted_at": "2023-12-26T14:02:06.440Z"
_11
}


Agents & Agent Pools

Update Agent

This operation partially updates an Agent

Parameters

TypeScript
agentId: string

Example: [object Object]


requestBody?: operations.UpdateAgentUpdateAgentRequest
Show child properties
firstName?: string

The first_name of the Agent


lastName?: string

The last name of the Agent


displayName?: string

The name to associate with the address for sending and receiving communications, visible to external contacts for some types of communications like email.


address?: string

The identifier within a channel address space for an actor (e.g. phone number)


channel?: components.CommunicationChannel

The medium which a unit of communication is transmitted through. These are differentiated by a mix of transmission protocol, network controller/owner, endpoint and address model, as well as the model for content of the atomic unit of communication itself.

Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateAgentResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


agent?: components.Agent

Ok

Show child properties

headers: Record<string, *string*[]>
UpdateAgent.ts

_25
import { TwillioSDKDocs } from "Twilio-Communications-API";
_25
import { CommunicationChannel } from "Twilio-Communications-API/models/components";
_25
_25
async function run() {
_25
const sdk = new TwillioSDKDocs({
_25
security: {
_25
username: "<YOUR_USERNAME_HERE>",
_25
password: "<YOUR_PASSWORD_HERE>",
_25
},
_25
});
_25
_25
const agentId = "01h9krwprkeee8fzqspvwy6nq8";
_25
const requestBody = {
_25
tags: {
_25
"key": {},
_25
},
_25
};
_25
_25
const result = await sdk.agentsAndAgentPools.updateAgent(agentId, requestBody);
_25
_25
// Handle the result
_25
console.log(result)
_25
}
_25
_25
run();

Example Response

_11
{
_11
"id": "agent_01h9krwprkeee8fzqspvwy6nq8",
_11
"display_name": "string",
_11
"first_name": "string",
_11
"last_name": "string",
_11
"address": "string",
_11
"tags": {},
_11
"updated_at": "2023-04-28T12:41:51.629Z",
_11
"created_at": "2023-11-17T13:53:16.489Z",
_11
"deleted_at": "2022-03-25T19:54:28.931Z"
_11
}


Agents & Agent Pools

Delete Agent

This operation deletes an Agent

Parameters

TypeScript
agentId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeleteAgentResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeleteAgent.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const agentId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.agentsAndAgentPools.deleteAgent(agentId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 361306,
_10
"message": "string",
_10
"more_info": "https://unwitting-degree.org"
_10
}


Agents & Agent Pools

Create Agent Pool

This operation creates an AgentPool

Parameters

TypeScript
request: operations.CreateAgentPoolCreateAgentPoolRequest

The request object to use for the request.

Show child properties
friendlyName?: string

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

stickySenderEnabled?: boolean

geomatch?: operations.AgentSettingsGeomatch
Show child properties

channelRank?: operations.AgentSettingsChannelRankItem[]

The rank provides a priority ordering for address selection for use in some operations. The lower the rank, the more preferred the channel.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateAgentPoolResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


agentPool?: components.AgentPool

Created

Show child properties

headers: Record<string, *string*[]>
CreateAgentPool.ts

_25
import { TwillioSDKDocs } from "Twilio-Communications-API";
_25
_25
async function run() {
_25
const sdk = new TwillioSDKDocs({
_25
security: {
_25
username: "<YOUR_USERNAME_HERE>",
_25
password: "<YOUR_PASSWORD_HERE>",
_25
},
_25
});
_25
_25
const result = await sdk.agentsAndAgentPools.createAgentPool({
_25
tags: {
_25
"key": {},
_25
},
_25
geomatch: {},
_25
channelRank: [
_25
{},
_25
],
_25
});
_25
_25
// Handle the result
_25
console.log(result)
_25
}
_25
_25
run();

Example Response

_19
{
_19
"id": "agentpool_01h9krwprkeee8fzqspvwy6nq8",
_19
"friendly_name": "string",
_19
"agent_count": 39615,
_19
"tags": {},
_19
"created_at": "2023-04-21T20:01:42.100Z",
_19
"updated_at": "2022-03-07T16:46:29.387Z",
_19
"deleted_at": "2023-07-22T07:16:07.451Z",
_19
"sticky_sender_enabled": false,
_19
"geomatch": {
_19
"country_code_enabled": false,
_19
"area_code_enabled": false
_19
},
_19
"channel_rank": [
_19
{
_19
"rank": 61078
_19
}
_19
]
_19
}


Agents & Agent Pools

List Agent Pools

This operation fetches a paginated list of AgentPools.

Parameters

TypeScript
channel?: components.CommunicationChannel

Filter to AgentPools that match a specific channel.

Show child properties
NameValue
emailemail
teltel
whatsappwhatsapp
fbmfbm
gbmgbm
chatchat
apnapn
fcmfcm

startDate?: Date

Filter to AgentPools created after the specified date and time.


endDate?: Date

Filter to AgentPools created before the specified date and time.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListAgentPoolsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listAgentPoolsResponse?: operations.ListAgentPoolsListAgentPoolsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListAgentPools.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
import { CommunicationChannel } from "Twilio-Communications-API/models/components";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const channel = CommunicationChannel.Apn;
_22
const startDate = new Date("2024-11-15T01:00:33.046Z");
_22
const endDate = new Date("2024-05-02T20:38:07.200Z");
_22
_22
const result = await sdk.agentsAndAgentPools.listAgentPools(channel, startDate, endDate);
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_29
{
_29
"agent_pools": [
_29
{
_29
"id": "agentpool_01h9krwprkeee8fzqspvwy6nq8",
_29
"friendly_name": "string",
_29
"agent_count": 907733,
_29
"tags": {},
_29
"created_at": "2022-07-22T01:28:25.533Z",
_29
"updated_at": "2024-03-21T21:54:23.935Z",
_29
"deleted_at": "2023-04-22T11:56:37.763Z",
_29
"sticky_sender_enabled": false,
_29
"geomatch": {
_29
"country_code_enabled": false,
_29
"area_code_enabled": false
_29
},
_29
"channel_rank": [
_29
{
_29
"rank": 898063
_29
}
_29
]
_29
}
_29
],
_29
"pagination": {
_29
"page": 672582,
_29
"prev": "string",
_29
"next": "string",
_29
"self": "string"
_29
}
_29
}


Agents & Agent Pools

Fetch One Agent Pool

This operation fetches a single AgentPool using its id.

Parameters

TypeScript
agentPoolId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneAgentPoolResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


agentPool?: components.AgentPool

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneAgentPool.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const agentPoolId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.agentsAndAgentPools.fetchOneAgentPool(agentPoolId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_19
{
_19
"id": "agentpool_01h9krwprkeee8fzqspvwy6nq8",
_19
"friendly_name": "string",
_19
"agent_count": 715208,
_19
"tags": {},
_19
"created_at": "2023-08-03T17:14:09.133Z",
_19
"updated_at": "2023-07-28T05:09:36.614Z",
_19
"deleted_at": "2022-11-30T16:09:25.930Z",
_19
"sticky_sender_enabled": false,
_19
"geomatch": {
_19
"country_code_enabled": false,
_19
"area_code_enabled": false
_19
},
_19
"channel_rank": [
_19
{
_19
"rank": 320565
_19
}
_19
]
_19
}


Agents & Agent Pools

Update Agent Pool

This operation partially updates an AgentPool

Parameters

TypeScript
agentPoolId: string

Example: [object Object]


requestBody?: operations.UpdateAgentPoolUpdateAgentPoolRequest
Show child properties
friendlyName?: string

The friendly name of the AgentPool


tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateAgentPoolResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


agentPool?: components.AgentPool

Ok

Show child properties

headers: Record<string, *string*[]>
UpdateAgentPool.ts

_24
import { TwillioSDKDocs } from "Twilio-Communications-API";
_24
_24
async function run() {
_24
const sdk = new TwillioSDKDocs({
_24
security: {
_24
username: "<YOUR_USERNAME_HERE>",
_24
password: "<YOUR_PASSWORD_HERE>",
_24
},
_24
});
_24
_24
const agentPoolId = "01h9krwprkeee8fzqspvwy6nq8";
_24
const requestBody = {
_24
tags: {
_24
"key": {},
_24
},
_24
};
_24
_24
const result = await sdk.agentsAndAgentPools.updateAgentPool(agentPoolId, requestBody);
_24
_24
// Handle the result
_24
console.log(result)
_24
}
_24
_24
run();

Example Response

_19
{
_19
"id": "agentpool_01h9krwprkeee8fzqspvwy6nq8",
_19
"friendly_name": "string",
_19
"agent_count": 3099,
_19
"tags": {},
_19
"created_at": "2023-02-01T23:01:15.488Z",
_19
"updated_at": "2023-10-17T15:27:23.255Z",
_19
"deleted_at": "2023-05-31T19:56:59.817Z",
_19
"sticky_sender_enabled": false,
_19
"geomatch": {
_19
"country_code_enabled": false,
_19
"area_code_enabled": false
_19
},
_19
"channel_rank": [
_19
{
_19
"rank": 649078
_19
}
_19
]
_19
}


Agents & Agent Pools

Delete Agent Pool

This operation deletes an AgentPool

Parameters

TypeScript
agentPoolId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeleteAgentPoolResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeleteAgentPool.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const agentPoolId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.agentsAndAgentPools.deleteAgentPool(agentPoolId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 5189,
_10
"message": "string",
_10
"more_info": "https://wild-coaster.name"
_10
}


Agents & Agent Pools

Add Agent To Agent Pool

This operation adds an Agent to an AgentPool

Parameters

TypeScript
agentPoolId: string

Example: [object Object]


requestBody?: operations.AddAgentToAgentPoolAddAgentToAgentPoolRequest
Show child properties
agentId?: string

A reference to an Agent.


Example: agent_01h9krwprkeee8fzqspvwy6nq8


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.AddAgentToAgentPoolResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


agentPool?: components.AgentPool

Created

Show child properties

headers: Record<string, *string*[]>
AddAgentToAgentPool.ts

_22
import { TwillioSDKDocs } from "Twilio-Communications-API";
_22
_22
async function run() {
_22
const sdk = new TwillioSDKDocs({
_22
security: {
_22
username: "<YOUR_USERNAME_HERE>",
_22
password: "<YOUR_PASSWORD_HERE>",
_22
},
_22
});
_22
_22
const agentPoolId = "01h9krwprkeee8fzqspvwy6nq8";
_22
const requestBody = {
_22
agentId: "agent_01h9krwprkeee8fzqspvwy6nq8",
_22
};
_22
_22
const result = await sdk.agentsAndAgentPools.addAgentToAgentPool(agentPoolId, requestBody);
_22
_22
// Handle the result
_22
console.log(result)
_22
}
_22
_22
run();

Example Response

_19
{
_19
"id": "agentpool_01h9krwprkeee8fzqspvwy6nq8",
_19
"friendly_name": "string",
_19
"agent_count": 327988,
_19
"tags": {},
_19
"created_at": "2022-11-18T06:52:13.468Z",
_19
"updated_at": "2024-01-16T15:53:29.217Z",
_19
"deleted_at": "2022-08-08T14:22:59.313Z",
_19
"sticky_sender_enabled": false,
_19
"geomatch": {
_19
"country_code_enabled": false,
_19
"area_code_enabled": false
_19
},
_19
"channel_rank": [
_19
{
_19
"rank": 63207
_19
}
_19
]
_19
}


Agents & Agent Pools

List Agents In Agent Pool

This operation fetches a paginated list of Agents that belong to a AgentPool.

Parameters

TypeScript
agentPoolId: string

Example: [object Object]


channel?: components.CommunicationChannel

Filter to Agents that match a specific channel.

Show child properties
NameValue
emailemail
teltel
whatsappwhatsapp
fbmfbm
gbmgbm
chatchat
apnapn
fcmfcm

startDate?: Date

Filter to Agents created after the specified date and time.


endDate?: Date

Filter to Agents created before the specified date and time.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListAgentsInAgentPoolResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listAgentsInAgentPoolResponse?: operations.ListAgentsInAgentPoolListAgentsInAgentPoolResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListAgentsInAgentPool.ts

_23
import { TwillioSDKDocs } from "Twilio-Communications-API";
_23
import { CommunicationChannel } from "Twilio-Communications-API/models/components";
_23
_23
async function run() {
_23
const sdk = new TwillioSDKDocs({
_23
security: {
_23
username: "<YOUR_USERNAME_HERE>",
_23
password: "<YOUR_PASSWORD_HERE>",
_23
},
_23
});
_23
_23
const agentPoolId = "01h9krwprkeee8fzqspvwy6nq8";
_23
const channel = CommunicationChannel.Tel;
_23
const startDate = new Date("2024-08-11T12:47:58.088Z");
_23
const endDate = new Date("2024-08-11T14:46:30.188Z");
_23
_23
const result = await sdk.agentsAndAgentPools.listAgentsInAgentPool(agentPoolId, channel, startDate, endDate);
_23
_23
// Handle the result
_23
console.log(result)
_23
}
_23
_23
run();

Example Response

_21
{
_21
"agents": [
_21
{
_21
"id": "agent_01h9krwprkeee8fzqspvwy6nq8",
_21
"display_name": "string",
_21
"first_name": "string",
_21
"last_name": "string",
_21
"address": "string",
_21
"tags": {},
_21
"updated_at": "2022-12-05T22:32:45.162Z",
_21
"created_at": "2023-06-08T12:00:49.203Z",
_21
"deleted_at": "2023-03-18T22:14:50.169Z"
_21
}
_21
],
_21
"pagination": {
_21
"page": 284000,
_21
"prev": "string",
_21
"next": "string",
_21
"self": "string"
_21
}
_21
}


Agents & Agent Pools

Remove Agent From Agent Pool

This operation removes an Agent from an AgentPool

Parameters

TypeScript
agentPoolId: string

Example: [object Object]


agentId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.RemoveAgentFromAgentPoolResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
RemoveAgentFromAgentPool.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const agentPoolId = "01h9krwprkeee8fzqspvwy6nq8";
_20
const agentId = "agent_01h9krwprkeee8fzqspvwy6nq8";
_20
_20
const result = await sdk.agentsAndAgentPools.removeAgentFromAgentPool(agentPoolId, agentId);
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_10
{
_10
"code": 633062,
_10
"message": "string",
_10
"more_info": "http://uniform-limestone.info"
_10
}


Domains

Available Operations


Domains

Create Domain

This operation creates a Domain. Verification of your Domain is required before you can use it. See 'Check a Domain' next.

Parameters

TypeScript
request: operations.CreateDomainCreateDomainRequest

The request object to use for the request.

Show child properties
domainName: string

A fully qualified domain name (FQDN) that you have registered with your DNS provider.


Example: example.com


capabilities?: components.DomainCapability[]

The capabilities that the Domain should be configured for.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateDomainResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


domain?: components.Domain

OK

Show child properties

headers: Record<string, *string*[]>
CreateDomain.ts

_23
import { TwillioSDKDocs } from "Twilio-Communications-API";
_23
import { } from "Twilio-Communications-API/models";
_23
_23
async function run() {
_23
const sdk = new TwillioSDKDocs({
_23
security: {
_23
username: "<YOUR_USERNAME_HERE>",
_23
password: "<YOUR_PASSWORD_HERE>",
_23
},
_23
});
_23
_23
const result = await sdk.domains.createDomain({
_23
domainName: "example.com",
_23
capabilities: [
_23
DomainCapability.Links,
_23
],
_23
});
_23
_23
// Handle the result
_23
console.log(result)
_23
}
_23
_23
run();

Example Response

_28
{
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com",
_28
"parent_domain": {
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com"
_28
},
_28
"sub_domains": [
_28
{
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com"
_28
}
_28
],
_28
"is_default": false,
_28
"capabilities": [],
_28
"dns": [
_28
{
_28
"host": "string",
_28
"value": "string",
_28
"is_verified": false,
_28
"last_verify_attempt_at": "2023-10-11T22:05:23.483Z",
_28
"updated_at": "2023-01-05T21:00:17.985Z"
_28
}
_28
],
_28
"created_at": "2023-04-19T05:40:14.539Z",
_28
"updated_at": "2024-11-29T15:51:58.240Z",
_28
"deleted_at": "2023-10-12T16:29:32.168Z"
_28
}


Domains

List Domains

This operation fetches a paginated list of Domains. Domains are used to authenticate domain names and configure DNS records for sending Email and communication links.

Parameters

TypeScript
options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListDomainsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listDomainsResponse?: operations.ListDomainsListDomainsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListDomains.ts

_17
import { TwillioSDKDocs } from "Twilio-Communications-API";
_17
_17
async function run() {
_17
const sdk = new TwillioSDKDocs({
_17
security: {
_17
username: "<YOUR_USERNAME_HERE>",
_17
password: "<YOUR_PASSWORD_HERE>",
_17
},
_17
});
_17
_17
const result = await sdk.domains.listDomains();
_17
_17
// Handle the result
_17
console.log(result)
_17
}
_17
_17
run();

Example Response

_38
{
_38
"domains": [
_38
{
_38
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_38
"domain_name": "example.com",
_38
"parent_domain": {
_38
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_38
"domain_name": "example.com"
_38
},
_38
"sub_domains": [
_38
{
_38
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_38
"domain_name": "example.com"
_38
}
_38
],
_38
"is_default": false,
_38
"capabilities": [],
_38
"dns": [
_38
{
_38
"host": "string",
_38
"value": "string",
_38
"is_verified": false,
_38
"last_verify_attempt_at": "2023-12-22T02:14:53.482Z",
_38
"updated_at": "2023-01-12T08:34:33.439Z"
_38
}
_38
],
_38
"created_at": "2023-12-16T22:20:05.073Z",
_38
"updated_at": "2023-10-10T18:22:17.403Z",
_38
"deleted_at": "2024-06-19T14:29:06.544Z"
_38
}
_38
],
_38
"pagination": {
_38
"page": 659177,
_38
"prev": "string",
_38
"next": "string",
_38
"self": "string"
_38
}
_38
}


Domains

Fetch One Domain

This operation fetches a Domain by its unique identifier.

Parameters

TypeScript
domainId: string

The unique identifier for the Domain.


Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneDomainResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


domain?: components.Domain

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneDomain.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const domainId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.domains.fetchOneDomain(domainId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_28
{
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com",
_28
"parent_domain": {
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com"
_28
},
_28
"sub_domains": [
_28
{
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com"
_28
}
_28
],
_28
"is_default": false,
_28
"capabilities": [],
_28
"dns": [
_28
{
_28
"host": "string",
_28
"value": "string",
_28
"is_verified": false,
_28
"last_verify_attempt_at": "2024-12-31T05:00:29.484Z",
_28
"updated_at": "2024-12-15T03:45:01.172Z"
_28
}
_28
],
_28
"created_at": "2023-01-21T16:11:36.352Z",
_28
"updated_at": "2023-05-07T03:56:56.428Z",
_28
"deleted_at": "2024-03-01T15:52:50.983Z"
_28
}


Domains

Update Domain

This operation updates a Domain by its unique identifier.

Parameters

TypeScript
domainId: string

The unique identifier for the Domain.


Example: [object Object]


requestBody?: operations.UpdateDomainUpdateDomainRequest
Show child properties
isDefault?: boolean

Whether this is the default Domain. Only one Domain can be the default Domain.


capabilities?: components.DomainCapability[]

The capabilities that the Domain should be configured for.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateDomainResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


domain?: components.Domain

OK

Show child properties

headers: Record<string, *string*[]>
UpdateDomain.ts

_25
import { TwillioSDKDocs } from "Twilio-Communications-API";
_25
import { } from "Twilio-Communications-API/models";
_25
_25
async function run() {
_25
const sdk = new TwillioSDKDocs({
_25
security: {
_25
username: "<YOUR_USERNAME_HERE>",
_25
password: "<YOUR_PASSWORD_HERE>",
_25
},
_25
});
_25
_25
const domainId = "01h9krwprkeee8fzqspvwy6nq8";
_25
const requestBody = {
_25
capabilities: [
_25
DomainCapability.Email,
_25
],
_25
};
_25
_25
const result = await sdk.domains.updateDomain(domainId, requestBody);
_25
_25
// Handle the result
_25
console.log(result)
_25
}
_25
_25
run();

Example Response

_28
{
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com",
_28
"parent_domain": {
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com"
_28
},
_28
"sub_domains": [
_28
{
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com"
_28
}
_28
],
_28
"is_default": false,
_28
"capabilities": [],
_28
"dns": [
_28
{
_28
"host": "string",
_28
"value": "string",
_28
"is_verified": false,
_28
"last_verify_attempt_at": "2024-06-10T02:34:07.582Z",
_28
"updated_at": "2022-10-20T07:11:40.624Z"
_28
}
_28
],
_28
"created_at": "2024-12-05T22:38:23.244Z",
_28
"updated_at": "2023-09-11T05:08:55.535Z",
_28
"deleted_at": "2024-09-02T05:07:56.253Z"
_28
}


Domains

Check Domain

This operation triggers Twilio to check the verification status of a Domain. Verification of a Domain is required before you can use it.

Parameters

TypeScript
domainId: string

The unique identifier for the Domain.


Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CheckDomainResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


domain?: components.Domain

OK

Show child properties

headers: Record<string, *string*[]>
CheckDomain.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const domainId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.domains.checkDomain(domainId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_28
{
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com",
_28
"parent_domain": {
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com"
_28
},
_28
"sub_domains": [
_28
{
_28
"id": "domain_01h9krwprkeee8fzqspvwy6nq8",
_28
"domain_name": "example.com"
_28
}
_28
],
_28
"is_default": false,
_28
"capabilities": [],
_28
"dns": [
_28
{
_28
"host": "string",
_28
"value": "string",
_28
"is_verified": false,
_28
"last_verify_attempt_at": "2024-02-05T06:43:41.039Z",
_28
"updated_at": "2022-10-26T08:43:16.322Z"
_28
}
_28
],
_28
"created_at": "2023-01-03T16:56:38.372Z",
_28
"updated_at": "2022-03-31T22:26:48.990Z",
_28
"deleted_at": "2022-06-11T20:43:17.206Z"
_28
}


Content And Media

*Use Content & Media to build, store, and retrieve reusable content templates and media files.*

Available Operations


Content & Media

Upload Media

This operation uploads a Media file.

Parameters

TypeScript
request: operations.UploadMediaUploadMediaJSONRequest

The request object to use for the request.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UploadMediaResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


media?: components.Media

Created

Show child properties

headers: Record<string, *string*[]>
UploadMedia.ts

_17
import { TwillioSDKDocs } from "Twilio-Communications-API";
_17
_17
async function run() {
_17
const sdk = new TwillioSDKDocs({
_17
security: {
_17
username: "<YOUR_USERNAME_HERE>",
_17
password: "<YOUR_PASSWORD_HERE>",
_17
},
_17
});
_17
_17
const result = await sdk.contentAndMedia.uploadMedia();
_17
_17
// Handle the result
_17
console.log(result)
_17
}
_17
_17
run();

Example Response

_17
{
_17
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_17
"file_name": "string",
_17
"file_size": 626.36,
_17
"mime_type": "text/plain",
_17
"content_reference": {
_17
"temporary_url": "http://essential-cat.info",
_17
"expires_at": "2022-10-13T15:34:35.218Z"
_17
},
_17
"tags": {},
_17
"created_by": {
_17
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8"
_17
},
_17
"updated_at": "2024-08-12T16:57:21.311Z",
_17
"created_at": "2024-04-27T07:11:23.285Z",
_17
"deleted_at": "2022-07-16T15:12:08.729Z"
_17
}


Content & Media

List Media

This operation fetches a paginated list of Media.

Parameters

TypeScript
request: operations.ListMediaRequest

The request object to use for the request.

Show child properties
startDate?: Date

Filter to Media created after the specified date and time.


endDate?: Date

Filter to Media created before the specified date and time.


uploadStatus?: components.MediaUploadStatus

Filter to Media with the specified upload status.

Show child properties

mimeType?: string

Filter to Media with the specified MIME type.


Example: text/plain


createdBy?: components.MediaAuthor

Filter to Media created by author.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListMediaResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listMediaResponse?: operations.ListMediaListMediaResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListMedia.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
import { MediaUploadStatus } from "Twilio-Communications-API/models/components";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const result = await sdk.contentAndMedia.listMedia({
_20
mimeType: "text/plain",
_20
});
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_27
{
_27
"media": [
_27
{
_27
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_27
"file_name": "string",
_27
"file_size": 4332.79,
_27
"mime_type": "text/plain",
_27
"content_reference": {
_27
"temporary_url": "http://general-brilliant.name",
_27
"expires_at": "2023-10-09T07:19:47.340Z"
_27
},
_27
"tags": {},
_27
"created_by": {
_27
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8"
_27
},
_27
"updated_at": "2024-03-27T22:57:03.217Z",
_27
"created_at": "2024-10-28T02:19:14.729Z",
_27
"deleted_at": "2024-07-18T13:44:51.693Z"
_27
}
_27
],
_27
"pagination": {
_27
"page": 52508,
_27
"prev": "string",
_27
"next": "string",
_27
"self": "string"
_27
}
_27
}


Content & Media

Fetch Single Media

This operation fetches a single Media object using its ID.

Parameters

TypeScript
mediaId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchSingleMediaResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


media?: components.Media

OK

Show child properties

headers: Record<string, *string*[]>
FetchSingleMedia.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const mediaId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.contentAndMedia.fetchSingleMedia(mediaId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_17
{
_17
"id": "media_01h9krwprkeee8fzqspvwy6nq8",
_17
"file_name": "string",
_17
"file_size": 5962.11,
_17
"mime_type": "text/plain",
_17
"content_reference": {
_17
"temporary_url": "https://unique-great-grandmother.net",
_17
"expires_at": "2023-02-21T20:20:12.317Z"
_17
},
_17
"tags": {},
_17
"created_by": {
_17
"address": "string"
_17
},
_17
"updated_at": "2024-04-18T10:24:49.909Z",
_17
"created_at": "2024-01-21T16:30:55.798Z",
_17
"deleted_at": "2022-07-27T05:06:14.785Z"
_17
}


Event Subscriptions

*Use Event Subscriptions, Sinks, and Schemas to tap into a unified stream of every interaction sent or received on Twilio.* - Stream your data to your existing systems by configuring a modern, persistent streaming technology like Amazon Kinesis or to a webhook.

- Easily consume and leverage data from multiple Twilio products with consistent metadata, well-defined and versioned schemas, and control over which events you want delivered.

- Trust that your events will be queued if your system goes down and delivered as soon as it's back up with event queuing for up to 24 hours or 5M events.

Available Operations


Event Subscriptions

Create Subscription

This operation creates an event subscription.

Parameters

TypeScript
request: operations.CreateSubscriptionCreateSubscriptionRequest

The request object to use for the request.

Show child properties
enabled?: boolean

Whether to enable the Subscription upon creation.


filters?: operations.CreateSubscriptionFilters

A set of filters that describe which events to subscribe to. The Subscription will only enable event flow for events that match the filters.

Show child properties

sinks?: operations.CreateSubscriptionSinks

A set of sinks that describe where to send events that match the Subscription's filters. Events 'flow' from source to sink.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateSubscriptionResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


subscription?: components.Subscription

Created

Show child properties

headers: Record<string, *string*[]>
CreateSubscription.ts

_30
import { TwillioSDKDocs } from "Twilio-Communications-API";
_30
_30
async function run() {
_30
const sdk = new TwillioSDKDocs({
_30
security: {
_30
username: "<YOUR_USERNAME_HERE>",
_30
password: "<YOUR_PASSWORD_HERE>",
_30
},
_30
});
_30
_30
const result = await sdk.eventSubscriptions.createSubscription({
_30
filters: {
_30
eventFilters: [
_30
{
_30
type: EventType.MessageSent,
_30
schemaVersionId: "string",
_30
},
_30
],
_30
resourceFilters: [
_30
,
_30
],
_30
},
_30
sinks: {},
_30
});
_30
_30
// Handle the result
_30
console.log(result)
_30
}
_30
_30
run();

Example Response

_26
{
_26
"id": "subscription_01h9krwprkeee8fzqspvwy6nq8",
_26
"enabled": false,
_26
"filters": {
_26
"event_filters": [
_26
{
_26
"schema_version_id": "string"
_26
}
_26
],
_26
"resource_filters": [
_26
{
_26
"audience_ids": [
_26
"audience_01h9krwprkeee8fzqspvwy6nq8"
_26
]
_26
}
_26
]
_26
},
_26
"sinks": {
_26
"primary": {
_26
"sink_id": "sink_01h9krwprkeee8fzqspvwy6nq8"
_26
},
_26
"fallback": {
_26
"sink_id": "sink_01h9krwprkeee8fzqspvwy6nq8"
_26
}
_26
}
_26
}


Event Subscriptions

Get Subscriptions

This operation fetches a paginated list of event Subscriptions.

Parameters

TypeScript
enabled?: boolean

Filter to Subscriptions by their enabled state.


startDate?: Date

Filter to Subscriptions created after the specified date and time.


endDate?: Date

Filter to Subscriptions created before the specified date and time.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.GetSubscriptionsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listSubscriptionsResponse?: operations.GetSubscriptionsListSubscriptionsResponse

OK

Show child properties

headers: Record<string, *string*[]>
GetSubscriptions.ts

_21
import { TwillioSDKDocs } from "Twilio-Communications-API";
_21
_21
async function run() {
_21
const sdk = new TwillioSDKDocs({
_21
security: {
_21
username: "<YOUR_USERNAME_HERE>",
_21
password: "<YOUR_PASSWORD_HERE>",
_21
},
_21
});
_21
_21
const enabled = false;
_21
const startDate = new Date("2024-05-25T21:04:00.708Z");
_21
const endDate = new Date("2024-05-27T19:09:23.162Z");
_21
_21
const result = await sdk.eventSubscriptions.getSubscriptions(enabled, startDate, endDate);
_21
_21
// Handle the result
_21
console.log(result)
_21
}
_21
_21
run();

Example Response

_34
{
_34
"subscriptions": [
_34
{
_34
"id": "subscription_01h9krwprkeee8fzqspvwy6nq8",
_34
"enabled": false,
_34
"filters": {
_34
"event_filters": [
_34
{
_34
"schema_version_id": "string"
_34
}
_34
],
_34
"resource_filters": [
_34
{
_34
"conversation_ids": [
_34
"conversation_01h9krwprkeee8fzqspvwy6nq8"
_34
]
_34
}
_34
]
_34
},
_34
"sinks": {
_34
"primary": {
_34
"url": "http://lonely-outlaw.name",
_34
"timeout_ms": 382440,
_34
"retries": 241557
_34
},
_34
"fallback": {
_34
"url": "http://worse-strength.org",
_34
"timeout_ms": 58534,
_34
"retries": 271113
_34
}
_34
}
_34
}
_34
]
_34
}


Event Subscriptions

Fetch Single Subscription

This operation fetches a single event Subscription using its Id.

Parameters

TypeScript
subscriptionId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchSingleSubscriptionResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


subscription?: components.Subscription

OK

Show child properties

headers: Record<string, *string*[]>
FetchSingleSubscription.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const subscriptionId = "subscription_01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.eventSubscriptions.fetchSingleSubscription(subscriptionId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_28
{
_28
"id": "subscription_01h9krwprkeee8fzqspvwy6nq8",
_28
"enabled": false,
_28
"filters": {
_28
"event_filters": [
_28
{
_28
"schema_version_id": "string"
_28
}
_28
],
_28
"resource_filters": [
_28
{
_28
"audience_ids": [
_28
"audience_01h9krwprkeee8fzqspvwy6nq8"
_28
]
_28
}
_28
]
_28
},
_28
"sinks": {
_28
"primary": {
_28
"flow_id": "flow_01h9krwprkeee8fzqspvwy6nq8"
_28
},
_28
"fallback": {
_28
"url": "http://joyful-lentil.org",
_28
"timeout_ms": 967260,
_28
"retries": 423706
_28
}
_28
}
_28
}


Event Subscriptions

Update Single Subscription

This operation updates an event Subscription using its Id.

Parameters

TypeScript
subscriptionId: string

requestBody?: operations.UpdateSingleSubscriptionUpdateSubscriptionRequest
Show child properties
enabled?: boolean

filters?: operations.UpdateSubscriptionFilters
Show child properties

sinks?: operations.UpdateSubscriptionSinks
Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateSingleSubscriptionResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


subscription?: components.Subscription

OK

Show child properties

headers: Record<string, *string*[]>
UpdateSingleSubscription.ts

_30
import { TwillioSDKDocs } from "Twilio-Communications-API";
_30
_30
async function run() {
_30
const sdk = new TwillioSDKDocs({
_30
security: {
_30
username: "<YOUR_USERNAME_HERE>",
_30
password: "<YOUR_PASSWORD_HERE>",
_30
},
_30
});
_30
_30
const subscriptionId = "string";
_30
const requestBody = {
_30
filters: {
_30
eventFilters: [
_30
{
_30
type: EventType.MessageSent,
_30
schemaVersionId: "string",
_30
},
_30
],
_30
},
_30
sinks: {},
_30
};
_30
_30
const result = await sdk.eventSubscriptions.updateSingleSubscription(subscriptionId, requestBody);
_30
_30
// Handle the result
_30
console.log(result)
_30
}
_30
_30
run();

Example Response

_28
{
_28
"id": "subscription_01h9krwprkeee8fzqspvwy6nq8",
_28
"enabled": false,
_28
"filters": {
_28
"event_filters": [
_28
{
_28
"schema_version_id": "string"
_28
}
_28
],
_28
"resource_filters": [
_28
{
_28
"conversation_ids": [
_28
"conversation_01h9krwprkeee8fzqspvwy6nq8"
_28
]
_28
}
_28
]
_28
},
_28
"sinks": {
_28
"primary": {
_28
"sink_id": "sink_01h9krwprkeee8fzqspvwy6nq8"
_28
},
_28
"fallback": {
_28
"url": "http://left-dissonance.info",
_28
"timeout_ms": 403793,
_28
"retries": 235263
_28
}
_28
}
_28
}


Event Subscriptions

Get Sinks

This operation fetches a paginated list of event Sinks (destinations for event Subscriptions).

Parameters

TypeScript
options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.GetSinksResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listSinksResponse?: operations.GetSinksListSinksResponse

OK

Show child properties

headers: Record<string, *string*[]>
GetSinks.ts

_17
import { TwillioSDKDocs } from "Twilio-Communications-API";
_17
_17
async function run() {
_17
const sdk = new TwillioSDKDocs({
_17
security: {
_17
username: "<YOUR_USERNAME_HERE>",
_17
password: "<YOUR_PASSWORD_HERE>",
_17
},
_17
});
_17
_17
const result = await sdk.eventSubscriptions.getSinks();
_17
_17
// Handle the result
_17
console.log(result)
_17
}
_17
_17
run();

Example Response

_11
{
_11
"sinks": [
_11
{
_11
"id": "sink_01h9krwprkeee8fzqspvwy6nq8",
_11
"name": "string",
_11
"configuration": {
_11
"flow_id": "flow_01h9krwprkeee8fzqspvwy6nq8"
_11
}
_11
}
_11
]
_11
}


Event Subscriptions

Create Sink

This operation creates an event Sink (destination for an event Subscription)

Parameters

TypeScript
request: operations.CreateSinkCreateSinkRequest

The request object to use for the request.

Show child properties
name?: string

configuration?: operations.CreateSinkRequestConfiguration

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateSinkResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


sink?: components.Sink

Created

Show child properties

headers: Record<string, *string*[]>
CreateSink.ts

_17
import { TwillioSDKDocs } from "Twilio-Communications-API";
_17
_17
async function run() {
_17
const sdk = new TwillioSDKDocs({
_17
security: {
_17
username: "<YOUR_USERNAME_HERE>",
_17
password: "<YOUR_PASSWORD_HERE>",
_17
},
_17
});
_17
_17
const result = await sdk.eventSubscriptions.createSink({});
_17
_17
// Handle the result
_17
console.log(result)
_17
}
_17
_17
run();

Example Response

_10
{
_10
"id": "sink_01h9krwprkeee8fzqspvwy6nq8",
_10
"name": "string",
_10
"configuration": {
_10
"url": "https://cloudy-filing.org",
_10
"timeout_ms": 713767,
_10
"retries": 399667
_10
}
_10
}


Event Subscriptions

Get Schemas

This operation fetches a paginated list of event Schemas.

Parameters

TypeScript
options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.GetSchemasResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listEventSchemasResponse?: operations.GetSchemasListEventSchemasResponse

OK

Show child properties

headers: Record<string, *string*[]>
GetSchemas.ts

_17
import { TwillioSDKDocs } from "Twilio-Communications-API";
_17
_17
async function run() {
_17
const sdk = new TwillioSDKDocs({
_17
security: {
_17
username: "<YOUR_USERNAME_HERE>",
_17
password: "<YOUR_PASSWORD_HERE>",
_17
},
_17
});
_17
_17
const result = await sdk.eventSubscriptions.getSchemas();
_17
_17
// Handle the result
_17
console.log(result)
_17
}
_17
_17
run();

Example Response

_22
{
_22
"schemas": [
_22
{
_22
"latest_version": {
_22
"id": "string",
_22
"raw_url": "https://helpful-gravity.com",
_22
"changelog_url": "http://hasty-orchard.name",
_22
"created_at": "2022-03-18T18:23:23.037Z",
_22
"deprecated_at": "2023-11-17T09:25:19.396Z"
_22
},
_22
"all_versions": [
_22
{
_22
"id": "string",
_22
"raw_url": "https://upset-pharmacopoeia.net",
_22
"changelog_url": "https://gargantuan-management.biz",
_22
"created_at": "2022-05-02T01:59:23.702Z",
_22
"deprecated_at": "2024-07-02T07:32:20.657Z"
_22
}
_22
]
_22
}
_22
]
_22
}


Event Subscriptions

Read Schemas By Type

This operation fetches a paginated list of event Schemas using their event type.

Parameters

TypeScript
eventType: string

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ReadSchemasByTypeResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listEventSchemasByEventTypeResponse?: operations.ReadSchemasByTypeListEventSchemasByEventTypeResponse

OK

Show child properties

headers: Record<string, *string*[]>
ReadSchemasByType.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const eventType = "string";
_19
_19
const result = await sdk.eventSubscriptions.readSchemasByType(eventType);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_20
{
_20
"schemas": {
_20
"latest_version": {
_20
"id": "string",
_20
"raw_url": "http://solid-guinea.biz",
_20
"changelog_url": "http://sad-animal.name",
_20
"created_at": "2024-03-19T00:44:08.177Z",
_20
"deprecated_at": "2023-03-15T00:39:25.767Z"
_20
},
_20
"all_versions": [
_20
{
_20
"id": "string",
_20
"raw_url": "http://messy-occupation.com",
_20
"changelog_url": "https://quaint-parsnip.com",
_20
"created_at": "2024-11-17T05:16:39.880Z",
_20
"deprecated_at": "2024-09-01T15:48:48.906Z"
_20
}
_20
]
_20
}
_20
}


Event Subscriptions

Fetch Event Schema Raw

This operation fetches a raw event Schema using its type and version.

Parameters

TypeScript
eventType: string

versionId: string

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchEventSchemaRawResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


body?: Uint8Array

fetchEventSchemaRawResponseJSON?: operations.FetchEventSchemaRawFetchEventSchemaRawResponseJSON

OK

Show child properties

headers: Record<string, *string*[]>
FetchEventSchemaRaw.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const eventType = "string";
_20
const versionId = "string";
_20
_20
const result = await sdk.eventSubscriptions.fetchEventSchemaRaw(eventType, versionId);
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();


Conversations

*Use Conversations to build engaging conversational messaging experiences across all communication types and all channels. Use directly with Messages, Emails, PushNotifications, and Communications to support two-way conversations with your customers*

Available Operations


Conversations

List Conversations

This operation fetches a paginated list of Conversations.

Parameters

TypeScript
request: operations.ListConversationsRequest

The request object to use for the request.

Show child properties
state?: components.ConversationState

Filter to Conversations with the specified state.

Show child properties

participantChannels?: components.CommunicationChannel[]

Filter to Conversations with participants that have the specified channels.

Show child properties

startDate?: Date

Filter to Conversations created after the specified date and time.


endDate?: Date

Filter to Conversations created before the specified date and time.


updatedDate?: Date

Filter to Conversations updated after the specified date and time.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListConversationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listConversationsResponse?: operations.ListConversationsListConversationsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListConversations.ts

_23
import { TwillioSDKDocs } from "Twilio-Communications-API";
_23
import { } from "Twilio-Communications-API/models";
_23
import { ConversationState } from "Twilio-Communications-API/models/components";
_23
_23
async function run() {
_23
const sdk = new TwillioSDKDocs({
_23
security: {
_23
username: "<YOUR_USERNAME_HERE>",
_23
password: "<YOUR_PASSWORD_HERE>",
_23
},
_23
});
_23
_23
const result = await sdk.conversations.listConversations({
_23
participantChannels: [
_23
CommunicationChannel.Fbm,
_23
],
_23
});
_23
_23
// Handle the result
_23
console.log(result)
_23
}
_23
_23
run();

Example Response

_26
{
_26
"conversations": [
_26
{
_26
"id": "conversation_01h9krwprkeee8fzqspvwy6nq8",
_26
"title": "string",
_26
"participant_count": 103298,
_26
"participant_channels": [],
_26
"message_count": 867168,
_26
"time_to": {
_26
"inactive": "2022-02-01T23:49:12.325Z",
_26
"closed": "2022-01-02T07:45:50.322Z",
_26
"deleted": "2023-08-10T06:27:10.605Z"
_26
},
_26
"tags": {},
_26
"created_at": "2024-10-24T04:36:14.577Z",
_26
"updated_at": "2023-03-20T01:13:26.553Z",
_26
"deleted_at": "2024-11-16T07:19:00.301Z"
_26
}
_26
],
_26
"pagination": {
_26
"page": 524184,
_26
"prev": "string",
_26
"next": "string",
_26
"self": "string"
_26
}
_26
}


Conversations

Patch Conversation

This operation partially updates a Conversation.

Parameters

TypeScript
conversationId: string

Example: [object Object]


requestBody?: operations.PatchConversationUpdateConversationRequest
Show child properties
title?: string

The title of the conversation.


state?: components.UpdateConversationState
Show child properties

timeTo?: operations.UpdateConversationTimeToStateTransition

The time at which the conversation will be transitioned to a new lifecycle state.

Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.PatchConversationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


conversation?: components.Conversation

OK

Show child properties

headers: Record<string, *string*[]>
PatchConversation.ts

_26
import { TwillioSDKDocs } from "Twilio-Communications-API";
_26
import { UpdateConversationState } from "Twilio-Communications-API/models/components";
_26
_26
async function run() {
_26
const sdk = new TwillioSDKDocs({
_26
security: {
_26
username: "<YOUR_USERNAME_HERE>",
_26
password: "<YOUR_PASSWORD_HERE>",
_26
},
_26
});
_26
_26
const conversationId = "01h9krwprkeee8fzqspvwy6nq8";
_26
const requestBody = {
_26
timeTo: {},
_26
tags: {
_26
"key": {},
_26
},
_26
};
_26
_26
const result = await sdk.conversations.patchConversation(conversationId, requestBody);
_26
_26
// Handle the result
_26
console.log(result)
_26
}
_26
_26
run();

Example Response

_16
{
_16
"id": "conversation_01h9krwprkeee8fzqspvwy6nq8",
_16
"title": "string",
_16
"participant_count": 796320,
_16
"participant_channels": [],
_16
"message_count": 992074,
_16
"time_to": {
_16
"inactive": "2023-01-25T07:50:37.582Z",
_16
"closed": "2022-01-21T23:00:31.318Z",
_16
"deleted": "2024-07-18T18:44:21.674Z"
_16
},
_16
"tags": {},
_16
"created_at": "2023-07-22T21:24:45.272Z",
_16
"updated_at": "2024-04-24T15:49:18.836Z",
_16
"deleted_at": "2024-07-12T16:24:09.257Z"
_16
}


Conversations

Fetch One Conversation

This operation fetches a single Conversation using its id.

Parameters

TypeScript
conversationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchOneConversationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


conversation?: components.Conversation

OK

Show child properties

headers: Record<string, *string*[]>
FetchOneConversation.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const conversationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.conversations.fetchOneConversation(conversationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_16
{
_16
"id": "conversation_01h9krwprkeee8fzqspvwy6nq8",
_16
"title": "string",
_16
"participant_count": 720528,
_16
"participant_channels": [],
_16
"message_count": 633415,
_16
"time_to": {
_16
"inactive": "2022-12-03T21:13:17.170Z",
_16
"closed": "2022-03-30T06:18:49.679Z",
_16
"deleted": "2023-08-12T20:35:15.275Z"
_16
},
_16
"tags": {},
_16
"created_at": "2022-04-04T12:01:07.035Z",
_16
"updated_at": "2022-10-28T22:25:19.613Z",
_16
"deleted_at": "2022-08-31T15:36:43.704Z"
_16
}


Conversations

Create Participant

This operation creates a Participant

Parameters

TypeScript
conversationId: string

Example: [object Object]


requestBody?: operations.CreateParticipantCreateParticipantRequest
Show child properties
agentId?: string

A reference to an Agent.


Example: agent_01h9krwprkeee8fzqspvwy6nq8


contactId?: string

A reference to a Contact.


Example: contact_01h9krwprkeee8fzqspvwy6nq8


addresses?: components.CommunicationAddress[]
Show child properties

lastReadMessage?: operations.CreateParticipantRequestLastReadMessage
Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateParticipantResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


participant?: components.Participant

Created

Show child properties

headers: Record<string, *string*[]>
CreateParticipant.ts

_35
import { TwillioSDKDocs } from "Twilio-Communications-API";
_35
_35
async function run() {
_35
const sdk = new TwillioSDKDocs({
_35
security: {
_35
username: "<YOUR_USERNAME_HERE>",
_35
password: "<YOUR_PASSWORD_HERE>",
_35
},
_35
});
_35
_35
const conversationId = "01h9krwprkeee8fzqspvwy6nq8";
_35
const requestBody = {
_35
agentId: "agent_01h9krwprkeee8fzqspvwy6nq8",
_35
contactId: "contact_01h9krwprkeee8fzqspvwy6nq8",
_35
addresses: [
_35
{
_35
address: "7617 McCullough Coves",
_35
channel: CommunicationChannel.Gbm,
_35
},
_35
],
_35
lastReadMessage: {
_35
id: "message_01h9krwprkeee8fzqspvwy6nq8",
_35
},
_35
tags: {
_35
"key": {},
_35
},
_35
};
_35
_35
const result = await sdk.conversations.createParticipant(conversationId, requestBody);
_35
_35
// Handle the result
_35
console.log(result)
_35
}
_35
_35
run();

Example Response

_18
{
_18
"id": "participant_01h9krwprkeee8fzqspvwy6nq8",
_18
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_18
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8",
_18
"addresses": [
_18
{
_18
"address": "string"
_18
}
_18
],
_18
"last_read_message": {
_18
"id": "message_01h9krwprkeee8fzqspvwy6nq8",
_18
"timestamp": "2022-04-20T14:46:11.627Z"
_18
},
_18
"tags": {},
_18
"created_at": "2022-01-28T08:08:46.184Z",
_18
"updated_at": "2022-10-18T11:36:15.419Z",
_18
"deleted_at": "2022-06-08T03:18:05.540Z"
_18
}


Conversations

List Participants

This operation fetches a paginated list of Participants.

Parameters

TypeScript
conversationId: string

Example: [object Object]


channel?: components.CommunicationChannel

Filter to Participants that match a specific channel.

Show child properties
NameValue
emailemail
teltel
whatsappwhatsapp
fbmfbm
gbmgbm
chatchat
apnapn
fcmfcm

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListParticipantsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listParticipantsResponse?: operations.ListParticipantsListParticipantsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListParticipants.ts

_21
import { TwillioSDKDocs } from "Twilio-Communications-API";
_21
import { CommunicationChannel } from "Twilio-Communications-API/models/components";
_21
_21
async function run() {
_21
const sdk = new TwillioSDKDocs({
_21
security: {
_21
username: "<YOUR_USERNAME_HERE>",
_21
password: "<YOUR_PASSWORD_HERE>",
_21
},
_21
});
_21
_21
const conversationId = "01h9krwprkeee8fzqspvwy6nq8";
_21
const channel = CommunicationChannel.Fcm;
_21
_21
const result = await sdk.conversations.listParticipants(conversationId, channel);
_21
_21
// Handle the result
_21
console.log(result)
_21
}
_21
_21
run();

Example Response

_28
{
_28
"participants": [
_28
{
_28
"id": "participant_01h9krwprkeee8fzqspvwy6nq8",
_28
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_28
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8",
_28
"addresses": [
_28
{
_28
"address": "string"
_28
}
_28
],
_28
"last_read_message": {
_28
"id": "message_01h9krwprkeee8fzqspvwy6nq8",
_28
"timestamp": "2023-07-18T01:56:09.832Z"
_28
},
_28
"tags": {},
_28
"created_at": "2022-03-13T21:40:13.733Z",
_28
"updated_at": "2022-09-02T00:47:39.361Z",
_28
"deleted_at": "2024-07-27T11:29:19.399Z"
_28
}
_28
],
_28
"pagination": {
_28
"page": 369490,
_28
"prev": "string",
_28
"next": "string",
_28
"self": "string"
_28
}
_28
}


Conversations

Fetch Single Participant

This operation fetches a single conversation participant using its ID.

Parameters

TypeScript
conversationId: string

Example: [object Object]


participantId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchSingleParticipantResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


participant?: components.Participant

OK

Show child properties

headers: Record<string, *string*[]>
FetchSingleParticipant.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const conversationId = "01h9krwprkeee8fzqspvwy6nq8";
_20
const participantId = "participant_01h9krwprkeee8fzqspvwy6nq8";
_20
_20
const result = await sdk.conversations.fetchSingleParticipant(conversationId, participantId);
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_18
{
_18
"id": "participant_01h9krwprkeee8fzqspvwy6nq8",
_18
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_18
"agent_id": "agent_01h9krwprkeee8fzqspvwy6nq8",
_18
"addresses": [
_18
{
_18
"address": "string"
_18
}
_18
],
_18
"last_read_message": {
_18
"id": "message_01h9krwprkeee8fzqspvwy6nq8",
_18
"timestamp": "2022-03-02T09:32:30.763Z"
_18
},
_18
"tags": {},
_18
"created_at": "2023-09-06T09:53:08.989Z",
_18
"updated_at": "2024-09-25T16:07:48.339Z",
_18
"deleted_at": "2024-04-27T16:58:28.547Z"
_18
}


Identity Verification

*Fight fraud and protect user accounts. Quickly verify users with OTP over any communication type (Message, Email, PushNotification), and with convenient methods like Passkeys, TOTP, and Silent Device Approval*

Available Operations


Identity Verification

Start Verification

This operation initiates a Verification session.

Parameters

TypeScript
request: operations.StartVerificationStartVerificationRequest

The request object to use for the request.

Show child properties
from?: operations.StartVerificationRequestFrom

The sending identity to associate with a Verification communication. To have Twilio optimize across multiple communication channels, use an AgentPool.


to?: operations.StartVerificationRequestTo

The user to Verify. - Use OTPRecipient to verify a user with an OTP communication at a specific address. - Use OTPCallRecipient to verify a user with an OTP over voice call. - Use FactorRecipient to verify a user with a Verify Factor.
- Use SilentNetworkAuthRecipient to verify a user with a Silent Network Authentication. - Use OmniVerificationRecipient to verify a known Contact with an optimal method.


content?: operations.VerificationContentInput

The content of the Verification communication. - For default content template, Twilio-generated OTP, and optional overrides use DefaultVerificationContent or leave empty. - For custom content use a communication type-specific content or OmniChannelContentInput.


processingOptions?: components.ProcessingOptions

Optional processing directives, specific to the related resources to be created.

Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.StartVerificationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


verification?: components.Verification

Created

Show child properties

headers: Record<string, *string*[]>
StartVerification.ts

_38
import { TwillioSDKDocs } from "Twilio-Communications-API";
_38
import { PushNotificationPriority } from "Twilio-Communications-API/models/components";
_38
_38
async function run() {
_38
const sdk = new TwillioSDKDocs({
_38
security: {
_38
username: "<YOUR_USERNAME_HERE>",
_38
password: "<YOUR_PASSWORD_HERE>",
_38
},
_38
});
_38
_38
const result = await sdk.identityVerification.startVerification({
_38
processingOptions: {
_38
usePreference: {},
_38
messages: {},
_38
emails: {
_38
replyTo: [
_38
,
_38
],
_38
cc: [
_38
,
_38
],
_38
bcc: [
_38
,
_38
],
_38
},
_38
pushNotifications: {},
_38
},
_38
tags: {
_38
"key": {},
_38
},
_38
});
_38
_38
// Handle the result
_38
console.log(result)
_38
}
_38
_38
run();

Example Response

_22
{
_22
"id": "verification_01h9krwprkeee8fzqspvwy6nq8",
_22
"to": {
_22
"phone_number": "string",
_22
"device_ip": "string",
_22
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_22
"user_identifier": {
_22
"user_identifier": "string"
_22
}
_22
},
_22
"silent_network_auth_url": "https://crisp-fairness.biz",
_22
"related": [
_22
{
_22
"id": "string",
_22
"uri": "string"
_22
}
_22
],
_22
"tags": {},
_22
"created_at": "2023-04-20T13:12:59.565Z",
_22
"updated_at": "2023-04-13T22:19:10.326Z",
_22
"deleted_at": "2023-08-02T22:40:10.384Z"
_22
}


Identity Verification

List Verifications

This operation fetches a paginated list of Verifications.

Parameters

TypeScript
request: operations.ListVerificationsRequest

The request object to use for the request.

Show child properties
status?: components.VerificationStatus

Filter to Verifications that match a specific status.

Show child properties

factorType?: components.FactorType

Filter to Verifications that match a specific recipient factor type.

Show child properties

contactId?: string

Filter to Verifications for a specific Contact.


Example: contact_01h9krwprkeee8fzqspvwy6nq8


userIdentifier?: string

Filter to Verifications for a specific user_identifier.


channel?: components.CommunicationChannel

Filter to Verifications that match a specific channel.

Show child properties

startDate?: Date

Filter to Verifications created after the specified date and time.


endDate?: Date

Filter to Verifications created before the specified date and time.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListVerificationsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listVerificationsResponse?: operations.ListVerificationsListVerificationsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListVerifications.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
import { CommunicationChannel, FactorType, VerificationStatus } from "Twilio-Communications-API/models/components";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const result = await sdk.identityVerification.listVerifications({
_20
contactId: "contact_01h9krwprkeee8fzqspvwy6nq8",
_20
});
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_30
{
_30
"verifications": [
_30
{
_30
"id": "verification_01h9krwprkeee8fzqspvwy6nq8",
_30
"to": {
_30
"address": "string",
_30
"address_extension": 3494.4,
_30
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_30
"user_identifier": "string"
_30
},
_30
"silent_network_auth_url": "https://impossible-riddle.info",
_30
"related": [
_30
{
_30
"id": "string",
_30
"uri": "string"
_30
}
_30
],
_30
"tags": {},
_30
"created_at": "2022-06-25T18:59:30.281Z",
_30
"updated_at": "2022-02-01T17:34:04.584Z",
_30
"deleted_at": "2023-01-19T19:51:06.284Z"
_30
}
_30
],
_30
"pagination": {
_30
"page": 895692,
_30
"prev": "string",
_30
"next": "string",
_30
"self": "string"
_30
}
_30
}


Identity Verification

Fetch Verification Settings

This operation fetches the current Verification settings.

Parameters

TypeScript
options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchVerificationSettingsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


verificationsSettings?: operations.FetchVerificationSettingsVerificationsSettings

OK

Show child properties

headers: Record<string, *string*[]>
FetchVerificationSettings.ts

_17
import { TwillioSDKDocs } from "Twilio-Communications-API";
_17
_17
async function run() {
_17
const sdk = new TwillioSDKDocs({
_17
security: {
_17
username: "<YOUR_USERNAME_HERE>",
_17
password: "<YOUR_PASSWORD_HERE>",
_17
},
_17
});
_17
_17
const result = await sdk.identityVerification.fetchVerificationSettings();
_17
_17
// Handle the result
_17
console.log(result)
_17
}
_17
_17
run();

Example Response

_10
{
_10
"time_to_expire": "PT10M",
_10
"time_to_delete": "P30D"
_10
}


Identity Verification

Update Verifications Settings

This operation partially updates the current Verifications resoure collection settings.

Parameters

TypeScript
request: components.VerificationsSettings

The request object to use for the request.

Show child properties
fraudGuardLevel?: components.FraudGuardLevel

The level of fraud protection to apply to the Verification. - none - No fraud protection is applied. - basic - Cautious fraud protection is applied. - standard - Standard fraud protection is applied. - maximum - Maximum fraud protection is applied.

Show child properties

timeToExpire?: string

The duration of time, in ISO 8601 duration format, after which Verifications automatically expire.


Example: PT10M


timeToDelete?: string

The duration of time, in ISO 8601 duration format, after which Verifications are automatically deleted.


Example: P30D


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateVerificationsSettingsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


verificationsSettings?: components.VerificationsSettings

OK

Show child properties

headers: Record<string, *string*[]>
UpdateVerificationsSettings.ts

_21
import { TwillioSDKDocs } from "Twilio-Communications-API";
_21
import { FraudGuardLevel } from "Twilio-Communications-API/models/components";
_21
_21
async function run() {
_21
const sdk = new TwillioSDKDocs({
_21
security: {
_21
username: "<YOUR_USERNAME_HERE>",
_21
password: "<YOUR_PASSWORD_HERE>",
_21
},
_21
});
_21
_21
const result = await sdk.identityVerification.updateVerificationsSettings({
_21
timeToExpire: "PT10M",
_21
timeToDelete: "P30D",
_21
});
_21
_21
// Handle the result
_21
console.log(result)
_21
}
_21
_21
run();

Example Response

_10
{
_10
"time_to_expire": "PT10M",
_10
"time_to_delete": "P30D"
_10
}


Identity Verification

Fetch Single Verification

This operation fetches a single Verification using its Id.

Parameters

TypeScript
verificationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchSingleVerificationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


verification?: components.Verification

OK

Show child properties

headers: Record<string, *string*[]>
FetchSingleVerification.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const verificationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.identityVerification.fetchSingleVerification(verificationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_22
{
_22
"id": "verification_01h9krwprkeee8fzqspvwy6nq8",
_22
"to": {
_22
"phone_number": "string",
_22
"device_ip": "string",
_22
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_22
"user_identifier": {
_22
"user_identifier": "string"
_22
}
_22
},
_22
"silent_network_auth_url": "https://remarkable-concern.org",
_22
"related": [
_22
{
_22
"id": "string",
_22
"uri": "string"
_22
}
_22
],
_22
"tags": {},
_22
"created_at": "2024-04-12T04:09:55.831Z",
_22
"updated_at": "2023-09-28T07:55:34.077Z",
_22
"deleted_at": "2023-02-04T12:58:54.972Z"
_22
}


Identity Verification

Delete Verification

This operation deletes a Verification

Parameters

TypeScript
verificationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.DeleteVerificationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


headers: Record<string, *string*[]>
DeleteVerification.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const verificationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.identityVerification.deleteVerification(verificationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_10
{
_10
"code": 455898,
_10
"message": "string",
_10
"more_info": "https://powerful-garb.biz"
_10
}


Identity Verification

Approve Verification

This operation approves a Verification

Parameters

TypeScript
verificationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ApproveVerificationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


verification?: components.Verification

OK

Show child properties

headers: Record<string, *string*[]>
ApproveVerification.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const verificationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.identityVerification.approveVerification(verificationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_20
{
_20
"id": "verification_01h9krwprkeee8fzqspvwy6nq8",
_20
"to": {
_20
"address": "string",
_20
"address_extension": 5510.79,
_20
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_20
"user_identifier": "string"
_20
},
_20
"silent_network_auth_url": "http://loathsome-consumption.net",
_20
"related": [
_20
{
_20
"id": "string",
_20
"uri": "string"
_20
}
_20
],
_20
"tags": {},
_20
"created_at": "2022-10-31T23:09:30.518Z",
_20
"updated_at": "2022-04-17T20:27:57.659Z",
_20
"deleted_at": "2023-07-29T17:17:11.069Z"
_20
}


Identity Verification

Cancel Verification

This operation cancels a Verification

Parameters

TypeScript
verificationId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CancelVerificationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


verification?: components.Verification

OK

Show child properties

headers: Record<string, *string*[]>
CancelVerification.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const verificationId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.identityVerification.cancelVerification(verificationId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_22
{
_22
"id": "verification_01h9krwprkeee8fzqspvwy6nq8",
_22
"to": {
_22
"phone_number": "string",
_22
"device_ip": "string",
_22
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_22
"user_identifier": {
_22
"user_identifier": "string"
_22
}
_22
},
_22
"silent_network_auth_url": "http://cumbersome-curtain.com",
_22
"related": [
_22
{
_22
"id": "string",
_22
"uri": "string"
_22
}
_22
],
_22
"tags": {},
_22
"created_at": "2024-11-29T22:07:11.339Z",
_22
"updated_at": "2024-03-29T12:47:02.537Z",
_22
"deleted_at": "2022-01-05T05:32:33.791Z"
_22
}


Identity Verification

Check Verification

This operation checks a Verification

Parameters

TypeScript
verificationId: string

Example: [object Object]


requestBody?: operations.CheckVerificationVerificationCheckRequest
Show child properties
code?: string

The 4-10 character string being verified.


amount?: string

The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.


payee?: string

The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CheckVerificationResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


verification?: components.Verification

OK

Show child properties

headers: Record<string, *string*[]>
CheckVerification.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const verificationId = "01h9krwprkeee8fzqspvwy6nq8";
_20
const requestBody = {};
_20
_20
const result = await sdk.identityVerification.checkVerification(verificationId, requestBody);
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_19
{
_19
"id": "verification_01h9krwprkeee8fzqspvwy6nq8",
_19
"to": {
_19
"factor_id": "factor_01h9krwprkeee8fzqspvwy6nq8",
_19
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_19
"user_identifier": "string"
_19
},
_19
"silent_network_auth_url": "https://dead-bidder.net",
_19
"related": [
_19
{
_19
"id": "string",
_19
"uri": "string"
_19
}
_19
],
_19
"tags": {},
_19
"created_at": "2024-12-06T13:47:40.819Z",
_19
"updated_at": "2024-02-28T16:53:18.712Z",
_19
"deleted_at": "2023-10-30T00:26:17.739Z"
_19
}


Identity Verification

Create Factor

This operation creates a Factor.

Parameters

TypeScript
request: operations.CreateFactorCreateFactorRequest

The request object to use for the request.

Show child properties
type: components.FactorType

The type of Verification Factor.

Show child properties

friendlyName?: string

A human-readable description of the Factor. Maximum length is 255 characters.


userIdentifier?: string

A custom string that identifies the end-user challenged for verification. E.g. an MD5 hash of your internal ID for this user.


contactId?: string

A reference to a Contact.


Example: contact_01h9krwprkeee8fzqspvwy6nq8


config: operations.CreateFactorConfiguration

The configuration of the Factor. The configuration is a JSON object that varies depending on the Factor type. See the Factor Configuration section for more information.

Show child properties

tags?: Record<string, components.Tags>

Custom metadata in the form of key-value pairs. Maximum size of a tag key is 128 characters. Maximum size of a tag value is 128 characters. There can be a maximum of 10 key-value pairs.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.CreateFactorResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


factor?: components.Factor

Created

Show child properties

headers: Record<string, *string*[]>
CreateFactor.ts

_25
import { TwillioSDKDocs } from "Twilio-Communications-API";
_25
import { FactorType } from "Twilio-Communications-API/models/components";
_25
_25
async function run() {
_25
const sdk = new TwillioSDKDocs({
_25
security: {
_25
username: "<YOUR_USERNAME_HERE>",
_25
password: "<YOUR_PASSWORD_HERE>",
_25
},
_25
});
_25
_25
const result = await sdk.identityVerification.createFactor({
_25
type: FactorType.Passkey,
_25
contactId: "contact_01h9krwprkeee8fzqspvwy6nq8",
_25
config: {},
_25
tags: {
_25
"key": {},
_25
},
_25
});
_25
_25
// Handle the result
_25
console.log(result)
_25
}
_25
_25
run();

Example Response

_16
{
_16
"id": "factor_01h9krwprkeee8fzqspvwy6nq8",
_16
"friendly_name": "string",
_16
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_16
"user_identifier": "string",
_16
"related": [
_16
{
_16
"id": "string",
_16
"uri": "string"
_16
}
_16
],
_16
"tags": {},
_16
"created_at": "2024-05-29T18:00:50.361Z",
_16
"updated_at": "2022-11-26T05:49:06.187Z",
_16
"deleted_at": "2024-07-05T15:43:09.972Z"
_16
}


Identity Verification

List Factors

This operation fetches a paginated list of Factors.

Parameters

TypeScript
request: operations.ListFactorsRequest

The request object to use for the request.

Show child properties
contactId?: string

Filter Factors by Contact Id.


Example: contact_01h9krwprkeee8fzqspvwy6nq8


type?: components.FactorType

Filter Factors by type.

Show child properties

status?: components.FactorStatus

Filter Factors by status.

Show child properties

friendlyName?: string

Filter Factors by friendly name.


startDate?: Date

Filter to Factors created after the specified date and time.


endDate?: Date

Filter to Factors created before the specified date and time.


sortBy?: string

Sort Factors by the specified field.


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.ListFactorsResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


listFactorsResponse?: operations.ListFactorsListFactorsResponse

OK

Show child properties

headers: Record<string, *string*[]>
ListFactors.ts

_20
import { TwillioSDKDocs } from "Twilio-Communications-API";
_20
import { FactorStatus, FactorType } from "Twilio-Communications-API/models/components";
_20
_20
async function run() {
_20
const sdk = new TwillioSDKDocs({
_20
security: {
_20
username: "<YOUR_USERNAME_HERE>",
_20
password: "<YOUR_PASSWORD_HERE>",
_20
},
_20
});
_20
_20
const result = await sdk.identityVerification.listFactors({
_20
contactId: "contact_01h9krwprkeee8fzqspvwy6nq8",
_20
});
_20
_20
// Handle the result
_20
console.log(result)
_20
}
_20
_20
run();

Example Response

_26
{
_26
"factors": [
_26
{
_26
"id": "factor_01h9krwprkeee8fzqspvwy6nq8",
_26
"friendly_name": "string",
_26
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_26
"user_identifier": "string",
_26
"related": [
_26
{
_26
"id": "string",
_26
"uri": "string"
_26
}
_26
],
_26
"tags": {},
_26
"created_at": "2023-04-01T12:09:35.022Z",
_26
"updated_at": "2023-07-25T18:06:31.513Z",
_26
"deleted_at": "2024-10-23T12:46:35.232Z"
_26
}
_26
],
_26
"pagination": {
_26
"page": 267207,
_26
"prev": "string",
_26
"next": "string",
_26
"self": "string"
_26
}
_26
}


Identity Verification

Update Factor

This operation partially updates a Factor.

Parameters

TypeScript
factorId: string

Example: [object Object]


requestBody?: operations.UpdateFactorUpdateFactorRequest
Show child properties
friendlyName?: string

A human-readable description of the Factor. Maximum length is 255 characters.


contactId?: string

A reference to a Contact.


Example: contact_01h9krwprkeee8fzqspvwy6nq8


userIdentifier?: string

A custom string that identifies the end-user challenged for verification. E.g. an MD5 hash of your internal ID for this user.


status?: components.FactorStatus

The verification status of the Factor. - unverified: The Factor is not yet verified and cannot be used in a Verification session. - verified: The Factor is verified and can be used in a Verification session. - expired: The Factor is expired and cannot be used in a Verification session.

Show child properties

authPayload?: string

The optional payload needed to verify the Factor for the first time. E.g. for a totp, the numeric code.


config?: operations.FetchFactorConfiguration

The configuration of the Factor. The configuration is a JSON object that varies depending on the Factor type. See the Factor Configuration section for more information.

Show child properties

options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.UpdateFactorResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


factor?: components.Factor

OK

Show child properties

headers: Record<string, *string*[]>
UpdateFactor.ts

_24
import { TwillioSDKDocs } from "Twilio-Communications-API";
_24
import { FactorStatus } from "Twilio-Communications-API/models/components";
_24
_24
async function run() {
_24
const sdk = new TwillioSDKDocs({
_24
security: {
_24
username: "<YOUR_USERNAME_HERE>",
_24
password: "<YOUR_PASSWORD_HERE>",
_24
},
_24
});
_24
_24
const factorId = "01h9krwprkeee8fzqspvwy6nq8";
_24
const requestBody = {
_24
contactId: "contact_01h9krwprkeee8fzqspvwy6nq8",
_24
config: {},
_24
};
_24
_24
const result = await sdk.identityVerification.updateFactor(factorId, requestBody);
_24
_24
// Handle the result
_24
console.log(result)
_24
}
_24
_24
run();

Example Response

_16
{
_16
"id": "factor_01h9krwprkeee8fzqspvwy6nq8",
_16
"friendly_name": "string",
_16
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_16
"user_identifier": "string",
_16
"related": [
_16
{
_16
"id": "string",
_16
"uri": "string"
_16
}
_16
],
_16
"tags": {},
_16
"created_at": "2023-02-12T14:57:02.990Z",
_16
"updated_at": "2023-04-12T20:04:56.275Z",
_16
"deleted_at": "2022-01-02T12:23:15.961Z"
_16
}


Identity Verification

Fetch Single Factor

This operation fetches a single Factor using its Id.

Parameters

TypeScript
factorId: string

Example: [object Object]


options?: RequestOptions

Options for making HTTP requests.


options.fetchOptions?: RequestInit

Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.

Response

TypeScript
Promise<operations.FetchSingleFactorResponse>
Hide child properties
contentType: string

HTTP response content type for this operation


statusCode: number

HTTP response status code for this operation


rawResponse: Response

Raw HTTP response; suitable for custom response parsing


factor?: components.Factor

OK

Show child properties

headers: Record<string, *string*[]>
FetchSingleFactor.ts

_19
import { TwillioSDKDocs } from "Twilio-Communications-API";
_19
_19
async function run() {
_19
const sdk = new TwillioSDKDocs({
_19
security: {
_19
username: "<YOUR_USERNAME_HERE>",
_19
password: "<YOUR_PASSWORD_HERE>",
_19
},
_19
});
_19
_19
const factorId = "01h9krwprkeee8fzqspvwy6nq8";
_19
_19
const result = await sdk.identityVerification.fetchSingleFactor(factorId);
_19
_19
// Handle the result
_19
console.log(result)
_19
}
_19
_19
run();

Example Response

_16
{
_16
"id": "factor_01h9krwprkeee8fzqspvwy6nq8",
_16
"friendly_name": "string",
_16
"contact_id": "contact_01h9krwprkeee8fzqspvwy6nq8",
_16
"user_identifier": "string",
_16
"related": [
_16
{
_16
"id": "string",
_16
"uri": "string"
_16
}
_16
],
_16
"tags": {},
_16
"created_at": "2022-12-15T18:48:51.114Z",
_16
"updated_at": "2023-09-23T10:23:19.435Z",
_16
"deleted_at": "2024-07-30T05:16:57.075Z"
_16
}