Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Messages resource


A Message resource represents a message sent or received through the Twilio Bulk Messaging API. You can send messages to up to 10,000 recipients in a single API request across SMS, MMS, RCS, and WhatsApp channels.

When you send messages, the API responds with a 202 Accepted status code and an operationId header. Use the Operations resource to track the status of your request.


Message Properties

message-properties page anchor
Property nameTypeRequiredPIIDescriptionChild properties
idstring
required
Not PII

A reference to a Message.

Example: comms_message_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_message_[0-7][a-hjkmnpqrstv-z0-9]{25,34}

from
oneOf:
required

The sender of the Message.


to
array(oneOf):
required

The list of recipient(s) that the Message was directed to.

  • This list is always of size 1, except for Group Messaging usage, where the number of recipients plus the sender will match the group size.

statusenum<string>
required

The status of a Message. The status can be one of the following:

  • SCHEDULED The Message is scheduled to be sent by Twilio in the future.

  • QUEUED The Message is queued in Twilio for sending.

  • SENT The Message has been sent by Twilio.

  • DELIVERED The Message has been successfully delivered to the recipient.

  • READ The Message has been read by the recipient.

  • UNDELIVERED The Message was successfully sent by Twilio but have not been delivered to the recipient.

  • FAILED The Message processing failed inside Twilio. Use GET /Messages/Operations/{operationId}/Errors for more details.

  • CANCELED The Message was canceled via API request.

  • GROUP The Message is part of a group communication. To get the status for each Recipient of the group communication, use the Receipts endpoint e.g. GET /Messages/comms_message_01h2xcejqtf2nbrexx3vqjhp41/Receipts

  • INBOUND The Message was received by Twilio from an external source.

Possible values:
QUEUEDSENTSCHEDULEDDELIVEREDREADFAILEDUNDELIVEREDCANCELEDGROUPINBOUND

relatedarray[RelatedResource]
required

A list of resources that are associated with the Message.


tagsTags
required

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 256 characters. There can be a maximum of 10 key-value pairs.

This field can be templated with Liquid(link takes you to an external page). Specify variables with each recipient for personalization.

Max properties: 10

createdAtstring<date-time>
required

The date and time when the entity was created.


updatedAtstring<date-time>
required

The date and time when the entity was last updated.


scheduledForstring or null
required

The scheduled send time of the Message. This field is only present if the Message was created with a schedule.


POST https://comms.twilio.com/v1/Messages

Create and send messages to the specified recipients.

The API responds with a 202 Accepted status code and an empty response body. The response headers include an operationId, which you can use to check the status of your request with the Operations resource.

Request body parameters

request-body-parameters page anchor
Encoding type:application/json
SchemaExample
Property nameTypeRequiredPIIDescriptionChild properties
to
array(oneOf):
required

An array of recipient objects to send the Message(s) to.

Min items: 1Max items: 10000

content
oneOf:
required

The content of the Message.


  • Use the Liquid(link takes you to an external page) templating language for personalization in any text-based field.

  • When using a templated content, use the variables field on each recipient to specify the values to substitute.

  • For each variable you specify in your template, you should have a matching key in each recipient's variables object.

  • When targeting Audience or Profile recipients, you may specify variables with values that reference stored traits on the Profile -- for example: ${Twilio.Profile.firstName} or ${Twilio.Profile.myCustomField}.


from
oneOf:

Optional

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


scheduleSchedule

Optional

A schedule defines when a communication will be sent to a recipient.

Min properties: 1

tagsTags

Optional

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 256 characters. There can be a maximum of 10 key-value pairs.

This field can be templated with Liquid(link takes you to an external page). Specify variables with each recipient for personalization.

Max properties: 10
202400429500503

The request was accepted and an Operation was created to track its progress. The response body contains the ID and link to the Operation resource.

SchemaExample
Property nameTypeRequiredDescriptionChild properties
operationIdstring

Optional

The Operation ID is an identifier that can be used to correlate all of the resources created in a request.

Issue a GET request to the resource list location, using the Operation ID as a query parameter to retrieve the resources that correlate with the Operation.

Example: comms_operation_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_operation_[0-7][a-hjkmnpqrstv-z0-9]{25,34}

operationLocationstring<uri>

Optional

The location (uri) of the Operation resource identified by operationId.

Send a basic SMSLink to code sample: Send a basic SMS
1
import { TwilioClient } from "twilio-comms";
2
3
async function main() {
4
const client = new TwilioClient({
5
accountId: "TWILIO_ACCOUNT_SID",
6
authToken: "TWILIO_AUTH_TOKEN",
7
});
8
await client.messages.send({
9
to: [
10
{
11
address: "+12065558844",
12
channel: "PHONE",
13
},
14
],
15
content: {
16
text: "Hello, World!",
17
},
18
from: {
19
address: "+14153901002",
20
channel: "SMS",
21
},
22
});
23
}
24
main();

GET https://comms.twilio.com/v1/Messages/{messageId}

Retrieve a Message by its identifier. The response includes full details about the sender, recipients, delivery status, message content, and all delivery attempts.

Property nameTypeRequiredPIIDescription
messageIdstring
required
Example: comms_message_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_message_[0-7][a-hjkmnpqrstv-z0-9]{25,34}
200400404429500503

OK

SchemaExample
Property nameTypeRequiredDescriptionChild properties
idstring

Optional

A reference to a Message.

Example: comms_message_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_message_[0-7][a-hjkmnpqrstv-z0-9]{25,34}

from
oneOf:

Optional

The sender of the Message.


to
array(oneOf):

Optional

The list of recipient(s) that the Message was directed to.

  • This list is always of size 1, except for Group Messaging usage, where the number of recipients plus the sender will match the group size.

statusenum<string>

Optional

The status of a Message. The status can be one of the following:

  • SCHEDULED The Message is scheduled to be sent by Twilio in the future.

  • QUEUED The Message is queued in Twilio for sending.

  • SENT The Message has been sent by Twilio.

  • DELIVERED The Message has been successfully delivered to the recipient.

  • READ The Message has been read by the recipient.

  • UNDELIVERED The Message was successfully sent by Twilio but have not been delivered to the recipient.

  • FAILED The Message processing failed inside Twilio. Use GET /Messages/Operations/{operationId}/Errors for more details.

  • CANCELED The Message was canceled via API request.

  • GROUP The Message is part of a group communication. To get the status for each Recipient of the group communication, use the Receipts endpoint e.g. GET /Messages/comms_message_01h2xcejqtf2nbrexx3vqjhp41/Receipts

  • INBOUND The Message was received by Twilio from an external source.

Possible values:
QUEUEDSENTSCHEDULEDDELIVEREDREADFAILEDUNDELIVEREDCANCELEDGROUPINBOUND

relatedarray[RelatedResource]

Optional

A list of resources that are associated with the Message.


tagsTags

Optional

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 256 characters. There can be a maximum of 10 key-value pairs.

This field can be templated with Liquid(link takes you to an external page). Specify variables with each recipient for personalization.

Max properties: 10

createdAtstring<date-time>

Optional

The date and time when the entity was created.


updatedAtstring<date-time>

Optional

The date and time when the entity was last updated.


scheduledForstring or null

Optional

The scheduled send time of the Message. This field is only present if the Message was created with a schedule.


content
oneOf:

Optional

The resolved content of the Message.


attemptsarray[MessageAttempt]

Optional

The list of attempts Twilio executed to process the Message.

1
import { TwilioClient } from "twilio-comms";
2
3
async function main() {
4
const client = new TwilioClient({
5
accountId: "TWILIO_ACCOUNT_SID",
6
authToken: "TWILIO_AUTH_TOKEN",
7
});
8
await client.messages.fetch("comms_message_01h9krwprkeee8fzqspvwy6nq8");
9
}
10
main();

GET https://comms.twilio.com/v1/Messages

Retrieve a list of Messages. Use query parameters to filter results by operation, channel, status, date range, and more.

Property nameTypeRequiredPIIDescription
operationIdstring

Optional

Filter Messages by Operation ID.

Example: comms_operation_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_operation_[0-7][a-hjkmnpqrstv-z0-9]{25,34}

sessionIdstring

Optional

Filter Messages by Session ID.

Example: comms_session_01h9krwprkeee8fzqspvwy6nq8Pattern: ^comms_session_[a-hjkmnpqrstv-z0-9]{26,34}

startDatestring<date-time>

Optional

Filter to Messages created after the specified date and time in ISO 8601 format. The date is in RFC3339 format. (e.g., 2025-06-18T12:00:00Z)


endDatestring<date-time>

Optional

Filter to Messages created before the specified date and time in ISO 8601 format. The date is in RFC3339 format and must be greater than startDate if provided. (e.g., 2025-06-18T12:00:00Z)


profilestring

Optional

Filter Messages sent or received by Profile ID.

Example: mem_profile_01h9krwprkeee8fzqspvwy6nq8Pattern: ^mem_profile_[0-7][a-hjkmnpqrstv-z0-9]{25,34}

channelenum<string>

Optional

Filter Messages by channel.

Example: SMSPossible values:
SMSRCSWHATSAPP

statusenum<string>

Optional

Filter Messages by Delivery Status.

Possible values:
QUEUEDSENTSCHEDULEDDELIVEREDREADFAILEDUNDELIVEREDCANCELEDGROUPINBOUND

tagsstring

Optional

Match messages by one or many tags. If more than one tag is specified in the query, the search will return messages that have all the tags. For Example: GET /Messages?tags=region:EMEA;campaign:BUY_STUFF;

Example: key_1:value;key_2:value;Pattern: ^(?:[a-zA-Z0-9._~-]+:[a-zA-Z0-9._~-]+;){1,10}$

pageTokenstring

Optional

The token to retrieve the next page of results.


pageSizeinteger

Optional

The number of resources to return in a page.

Default: 50Example: 50Minimum: 1Maximum: 1000
200400429500503

OK

SchemaExample
Property nameTypeRequiredDescriptionChild properties
messagesarray[MessageMetadata]

Optional

A list of Messages.


paginationPaginationMetadata

Optional

Metadata for paginated results. This object contains two tokens to navigate through paginated results.

  • Use next to retrieve the 'next' page in the result list.
  • Use self to retrieve the same page of the result list again.
  • Supply the token in the pageToken query param.
1
import { TwilioClient } from "twilio-comms";
2
3
async function main() {
4
const client = new TwilioClient({
5
accountId: "TWILIO_ACCOUNT_SID",
6
authToken: "TWILIO_AUTH_TOKEN",
7
});
8
await client.messages.list({
9
operationId: "comms_operation_01h9krwprkeee8fzqspvwy6nq8",
10
sessionId: "comms_session_01h9krwprkeee8fzqspvwy6nq8",
11
startDate: new Date("2024-01-15T09:30:00Z"),
12
endDate: new Date("2024-01-15T09:30:00Z"),
13
profile: "mem_profile_01h9krwprkeee8fzqspvwy6nq8",
14
channel: "SMS",
15
status: "QUEUED",
16
tags: "key_1:value;key_2:value;",
17
pageToken: "pageToken",
18
pageSize: 50,
19
});
20
}
21
main();