Retrieve a list of all messages in the conversation

GET /v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages

A Service Message resource represents a message in a conversation within a specific service.

Retrieve a list of all messages in the conversation

Path parameters

  • ChatServiceSid string Required

    The SID of the Conversation Service the Participant resource is associated with.

    Minimum length is 34, maximum length is 34. Format should match the following pattern: ^IS[0-9a-fA-F]{32}$.

  • ConversationSid string Required

    The unique ID of the Conversation for messages.

Query parameters

  • Order string

    The sort order of the returned messages. Can be: asc (ascending) or desc (descending), with asc as the default.

    Values are asc or desc.

  • PageSize integer(int64)

    How many resources to return in each list page. The default is 50, and the maximum is 100.

    Minimum value is 1, maximum value is 100.

  • Page integer

    The page index. This value is simply for client state.

    Minimum value is 0.

  • PageToken string

    The page token. This is provided by the API.

Responses

  • 200 application/json

    OK

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • messages array[object]
      Hide messages attributes Show messages attributes object
      • account_sid string | null

        The unique ID of the Account responsible for this message.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

      • chat_service_sid string | null

        The SID of the Conversation Service the Participant resource is associated with.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^IS[0-9a-fA-F]{32}$.

      • conversation_sid string | null

        The unique ID of the Conversation for this message.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^CH[0-9a-fA-F]{32}$.

      • sid string | null

        A 34 character string that uniquely identifies this resource.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^IM[0-9a-fA-F]{32}$.

      • index integer

        The index of the message within the Conversation.

        Default value is 0.

      • author string | null

        The channel specific identifier of the message's author. Defaults to system.

      • body string | null

        The content of the message, can be up to 1,600 characters long.

      • media array | null

        An array of objects that describe the Message's media, if the message contains media. Each object contains these fields: content_type with the MIME type of the media, filename with the name of the media, sid with the SID of the Media resource, and size with the media object's file size in bytes. If the Message has no media, this value is null.

      • attributes string | null

        A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. Note that if the attributes are not set "{}" will be returned.

      • participant_sid string | null

        The unique ID of messages's author participant. Null in case of system sent message.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^MB[0-9a-fA-F]{32}$.

      • date_created string(date-time) | null

        The date that this resource was created.

      • date_updated string(date-time) | null

        The date that this resource was last updated. null if the message has not been edited.

      • delivery

        An object that contains the summary of delivery statuses for the message to non-chat participants.

      • url string(uri) | null

        An absolute API resource URL for this message.

      • content_sid string | null

        The unique ID of the multi-channel Rich Content template.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^HX[0-9a-fA-F]{32}$.

    • meta object
      Hide meta attributes Show meta attributes object
      • first_page_url string(uri)
      • key string
      • next_page_url string(uri) | null
      • page integer
      • page_size integer
      • previous_page_url string(uri) | null
      • url string(uri)
GET /v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages
curl \
 --request GET 'https://conversations.twilio.com/v1/Services/{ChatServiceSid}/Conversations/{ConversationSid}/Messages' \
 --user "username:password"
Response examples (200)
{
  "meta": {
    "key": "messages",
    "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages?PageSize=50&Page=0",
    "page": 0,
    "page_size": 50,
    "next_page_url": null,
    "first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages?PageSize=50&Page=0",
    "previous_page_url": null
  },
  "messages": [
    {
      "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "body": "I like pie.",
      "index": 0,
      "links": {
        "channel_metadata": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelMetadata",
        "delivery_receipts": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Receipts"
      },
      "media": null,
      "author": "pie_preferrer",
      "delivery": {
        "read": "some",
        "sent": "all",
        "total": 2,
        "failed": "none",
        "delivered": "some",
        "undelivered": "none"
      },
      "attributes": "{ \"importance\": \"high\" }",
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "content_sid": null,
      "date_created": "2016-03-24T20:37:57Z",
      "date_updated": "2016-03-24T20:37:57Z",
      "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    },
    {
      "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "body": "Cake is my favorite!",
      "index": 0,
      "links": {
        "channel_metadata": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelMetadata",
        "delivery_receipts": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Receipts"
      },
      "media": null,
      "author": "cake_lover",
      "delivery": {
        "read": "some",
        "sent": "all",
        "total": 2,
        "failed": "none",
        "delivered": "some",
        "undelivered": "none"
      },
      "attributes": "{ \"importance\": \"high\" }",
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "content_sid": null,
      "date_created": "2016-03-24T20:38:21Z",
      "date_updated": "2016-03-24T20:38:21Z",
      "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    },
    {
      "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "body": null,
      "index": 0,
      "links": {
        "channel_metadata": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelMetadata",
        "delivery_receipts": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Receipts"
      },
      "media": [
        {
          "sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "size": 42056,
          "filename": "car.jpg",
          "content_type": "image/jpeg"
        }
      ],
      "author": "cake_lover",
      "delivery": {
        "read": "some",
        "sent": "all",
        "total": 2,
        "failed": "none",
        "delivered": "some",
        "undelivered": "none"
      },
      "attributes": "{ \"importance\": \"high\" }",
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "content_sid": null,
      "date_created": "2016-03-24T20:38:21Z",
      "date_updated": "2016-03-24T20:38:21Z",
      "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    }
  ]
}
{
  "meta": {
    "key": "messages",
    "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages?Order=desc&PageSize=2&Page=0",
    "page": 0,
    "page_size": 2,
    "next_page_url": null,
    "first_page_url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages?Order=desc&PageSize=2&Page=0",
    "previous_page_url": null
  },
  "messages": [
    {
      "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "url": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "body": null,
      "index": 9,
      "links": {
        "channel_metadata": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ChannelMetadata",
        "delivery_receipts": "https://conversations.twilio.com/v1/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Receipts"
      },
      "media": [
        {
          "sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
          "size": 42056,
          "filename": "car.jpg",
          "content_type": "image/jpeg"
        }
      ],
      "author": "cake_lover",
      "delivery": {
        "read": "some",
        "sent": "all",
        "total": 2,
        "failed": "none",
        "delivered": "some",
        "undelivered": "none"
      },
      "attributes": "{ \"importance\": \"high\" }",
      "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "content_sid": null,
      "date_created": "2016-03-24T20:38:21Z",
      "date_updated": "2016-03-24T20:38:21Z",
      "participant_sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "chat_service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
      "conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    }
  ]
}