For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
SDKsHelp CenterLog inSign up
    • Overview
  • Getting Started
    • API Mechanics
    • Quickstart
  • Guides
    • Communications API
    • Troubleshooting
    • Events
    • Changelog
  • Comms API Reference
      • Summary
      • POSTSend Messages
      • GETList Messages
      • GETFetch a Message
      • GETFetch a Message Operation
      • GETList Message Operations
      • GETSeek a Message by an Identifier
LogoLogo
SDKsHelp CenterLog inSign up
Comms API ReferenceMessages

Fetch a Message

GET
https://comms.twilio.com/v1/Messages/:messageId
GET
/v1/Messages/:messageId
1import { TwilioClient } from "twilio-comms";
2
3async function main() {
4 const client = new TwilioClient({
5 accountId: "YOUR_ACCOUNTID_HERE",
6 authToken: "YOUR_AUTHTOKEN_HERE",
7 });
8 await client.messages.fetch("messageId");
9}
10main();
1{
2 "attempts": [
3 {
4 "from": {
5 "address": "bowlingteam_212_sender",
6 "channel": "RCS",
7 "senderId": "comms_sender_01h9krwprkeee8fzqspvwy6nq8"
8 },
9 "to": [
10 {
11 "address": "+14153901002",
12 "channel": "PHONE"
13 }
14 ],
15 "status": "FAILED",
16 "attemptedAt": "2023-08-24T14:15:22Z",
17 "infoUrl": "https://console.twilio.com/us1/monitor/logs/sms/AC77ec7f777777f7a77ce7777aeef7777f/SMbffad777cc7777777777777dfcdc7f77",
18 "error": {
19 "code": 61337,
20 "message": "Recipient does not have RCS enabled.",
21 "infoUrl": "https://twilio.com/docs/api/errors/61337"
22 }
23 },
24 {
25 "from": {
26 "address": "+12065558844",
27 "channel": "SMS",
28 "senderId": "comms_sender_01h9krwprkeee8fzqspvwy6nq8"
29 },
30 "to": [
31 {
32 "address": "+14153901002",
33 "channel": "PHONE"
34 }
35 ],
36 "status": "DELIVERED",
37 "attemptedAt": "2023-08-24T14:15:22Z",
38 "infoUrl": "https://console.twilio.com/us1/monitor/logs/sms/AC77ec7f777777f7a77ce7777aeef7777f/SMbffad777cc7777777777777dfcdc7f77",
39 "error": null
40 }
41 ],
42 "content": {
43 "text": "Thanks for joining us today!",
44 "media": [
45 {
46 "url": "http://content.cool.co/party-thanks.png"
47 }
48 ]
49 },
50 "createdAt": "2023-08-24T14:15:22Z",
51 "from": {
52 "address": "+12065558844",
53 "channel": "SMS",
54 "senderId": "comms_sender_01h9krwprkeee8fzqspvwy6nq8"
55 },
56 "id": "comms_message_2x4y6z8a0b1c2d3e4f5g6h7j8k",
57 "related": [
58 {
59 "name": "SESSION",
60 "id": "comms_session_01h2xcejqtf2nbrexx3vqjhp41",
61 "uri": "https://comms.twilio.com/v1/Sessions/comms_session_01h2xcejqtf2nbrexx3vqjhp41"
62 }
63 ],
64 "scheduledFor": null,
65 "status": "DELIVERED",
66 "tags": {},
67 "to": [
68 {
69 "address": "+14153901002",
70 "channel": "PHONE"
71 }
72 ],
73 "updatedAt": "2023-08-24T14:15:22Z",
74 "deletedAt": null
75}

This operation fetches a single Message using its ID.

Data retention: Records are available for 7 days after creation. Requests for data older than 7 days may return incomplete results.

Was this page helpful?
Previous

Fetch a Message Operation

Next
Built with

Authentication

AuthorizationBasic

Basic authentication of the form Basic <account_id:auth_token>.

OR
AuthorizationBasic

Basic authentication of the form Basic <api_key:api_key_secret>.

Path parameters

messageIdstringRequired

Response

OK
attemptslist of objects
The list of attempts Twilio executed to process the Message.
contentobject
The resolved content of the Message.
createdAtstringformat: "date-time"
The date and time when the entity was created.
fromobject
The sender of the Message.
idstringformat: "^comms_message_[0-7][a-hjkmnpqrstv-z0-9]{25,34}"
A reference to a Message.
relatedlist of objects
A list of resources that are associated with the Message.
scheduledForstring or null

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

statusenum

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.

tagsmap from strings to strings

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. Specify variables with each recipient for personalization.

tolist of objects

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.
updatedAtstringformat: "date-time"
The date and time when the entity was last updated.

Errors

400
Bad Request Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error