---
title: "List messages by channel identity"
method: POST
path: "/v1/projects/{project_id}/messages:fetch-last-message"
tags: ["Messages"]
---

# List messages by channel identity

`POST /v1/projects/{project_id}/messages:fetch-last-message`

Retrieves the last message sent to specified channel identities. In CONVERSATION_SOURCE mode, you can query either by channel_identities or by contact_ids. Note: Use either contact_ids OR channel_identities per request, not both. DISPATCH_SOURCE mode does not support contact_ids.

## Request body

- ListMessagesByChannelIdentityRequest — Request body for listing messages by channel identity. NOTE: You can use either contact_ids OR channel_identities, but not both in the same request.
  - `channel_identities` string[] — Optional. Filter messages by `channel_identity`.
  - `contact_ids` string[] — Optional. Resource name (id) of the contact. In case the messages source is set to `CONVERSATION_SOURCE`: Can list last messages by contact_id. In case the messages source is set to `DISPATCH_SOURCE`: The field is unsupported and cannot be set.
  - `app_id` string — Optional. Resource name (id) of the app.
  - `messages_source` 'CONVERSATION_SOURCE' | 'DISPATCH_SOURCE' — Specifies the message source for which the request will be processed. Used for operations on messages in Dispatch Mode. For more information, see [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/).
  - `page_size` integer — Optional. Maximum number of messages to fetch. Defaults to 10 and the maximum is 1000.
  - `page_token` string — Optional. Next page token previously returned if any.
  - `view` 'WITH_METADATA' | 'WITHOUT_METADATA' — Optional. Specifies the representation in which messages should be returned. Default to `WITH_METADATA`.
  - `start_time` string, date-time — Optional. Only fetch messages with `accept_time` after this date.
  - `end_time` string, date-time — Optional. Only fetch messages with `accept_time` before this date.
  - `channel` 'SMS' | 'RCS' | 'WHATSAPP' | 'MMS' | 'KAKAOTALK' | 'KAKAOTALKCHAT' | 'VIBERBM' | 'LINE' | 'INSTAGRAM' | 'MESSENGER' | 'WECHAT' | 'TELEGRAM' | 'APPLEBC' — The identifier of the channel you want to include. Must be one of the enum values.
  - `direction` 'TO_APP' | 'TO_CONTACT' — The direction of the message flow, indicating whether the message was sent to or from the Conversation API app.

## Response `200`

A successful response.

- ListMessagesResponse
  - `messages` ConversationMessage[] — List of messages associated to the referenced conversation.
    - union
      - object — A message on a particular channel.
        - `app_message` union
          - object — Field containing a Card Message
            - `card_message` CardMessage — Message containing text, media and choices.
              - …
            - `explicit_channel_message` object — Allows you to specify a channel and define a corresponding channel specific message payload that will override the standard Conversation API message types. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The message content must be provided in a string format. You may use the [transcoding endpoint](https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Transcoding/) to help create your message. For more information about how to construct an explicit channel message for a particular channel, see that [channel's corresponding documentation](https://developers.sinch.com/docs/conversation/channel-support/) (for example, using explicit channel messages with [the WhatsApp channel](https://developers.sinch.com/docs/conversation/channel-support/whatsapp/message-support/#explicit-channel-messages)).
            - `explicit_channel_omni_message` object — Override the message's content for specified channels. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The content defined under the specified channel will be sent on that channel.
            - `channel_specific_message` object — Channel specific messages, overriding any transcoding. The structure of this property is more well-defined than the open structure of the `explicit_channel_message` property, and may be easier to use. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`.
            - `agent` Agent — Represents an agent that is involved in a conversation.
              - …
          - object — Message containing a list of cards often rendered horizontally on supported channels.
            - `carousel_message` object
              - …
            - `explicit_channel_message` object — Allows you to specify a channel and define a corresponding channel specific message payload that will override the standard Conversation API message types. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The message content must be provided in a string format. You may use the [transcoding endpoint](https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Transcoding/) to help create your message. For more information about how to construct an explicit channel message for a particular channel, see that [channel's corresponding documentation](https://developers.sinch.com/docs/conversation/channel-support/) (for example, using explicit channel messages with [the WhatsApp channel](https://developers.sinch.com/docs/conversation/channel-support/whatsapp/message-support/#explicit-channel-messages)).
            - `explicit_channel_omni_message` object — Override the message's content for specified channels. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The content defined under the specified channel will be sent on that channel.
            - `channel_specific_message` object — Channel specific messages, overriding any transcoding. The structure of this property is more well-defined than the open structure of the `explicit_channel_message` property, and may be easier to use. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`.
            - `agent` Agent — Represents an agent that is involved in a conversation.
              - …
          - object — Message containing choices/actions.
            - `choice_message` object — Additional properties for the message.
              - …
            - `explicit_channel_message` object — Allows you to specify a channel and define a corresponding channel specific message payload that will override the standard Conversation API message types. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The message content must be provided in a string format. You may use the [transcoding endpoint](https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Transcoding/) to help create your message. For more information about how to construct an explicit channel message for a particular channel, see that [channel's corresponding documentation](https://developers.sinch.com/docs/conversation/channel-support/) (for example, using explicit channel messages with [the WhatsApp channel](https://developers.sinch.com/docs/conversation/channel-support/whatsapp/message-support/#explicit-channel-messages)).
            - `explicit_channel_omni_message` object — Override the message's content for specified channels. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The content defined under the specified channel will be sent on that channel.
            - `channel_specific_message` object — Channel specific messages, overriding any transcoding. The structure of this property is more well-defined than the open structure of the `explicit_channel_message` property, and may be easier to use. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`.
            - `agent` Agent — Represents an agent that is involved in a conversation.
              - …
          - object — Message containing geographic location.
            - `location_message` object
              - …
            - `explicit_channel_message` object — Allows you to specify a channel and define a corresponding channel specific message payload that will override the standard Conversation API message types. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The message content must be provided in a string format. You may use the [transcoding endpoint](https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Transcoding/) to help create your message. For more information about how to construct an explicit channel message for a particular channel, see that [channel's corresponding documentation](https://developers.sinch.com/docs/conversation/channel-support/) (for example, using explicit channel messages with [the WhatsApp channel](https://developers.sinch.com/docs/conversation/channel-support/whatsapp/message-support/#explicit-channel-messages)).
            - `explicit_channel_omni_message` object — Override the message's content for specified channels. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The content defined under the specified channel will be sent on that channel.
            - `channel_specific_message` object — Channel specific messages, overriding any transcoding. The structure of this property is more well-defined than the open structure of the `explicit_channel_message` property, and may be easier to use. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`.
            - `agent` Agent — Represents an agent that is involved in a conversation.
              - …
          - object — A message containing a media component, such as an image, document, or video.
            - `media_message` MediaProperties
              - …
            - `explicit_channel_message` object — Allows you to specify a channel and define a corresponding channel specific message payload that will override the standard Conversation API message types. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The message content must be provided in a string format. You may use the [transcoding endpoint](https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Transcoding/) to help create your message. For more information about how to construct an explicit channel message for a particular channel, see that [channel's corresponding documentation](https://developers.sinch.com/docs/conversation/channel-support/) (for example, using explicit channel messages with [the WhatsApp channel](https://developers.sinch.com/docs/conversation/channel-support/whatsapp/message-support/#explicit-channel-messages)).
            - `explicit_channel_omni_message` object — Override the message's content for specified channels. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The content defined under the specified channel will be sent on that channel.
            - `channel_specific_message` object — Channel specific messages, overriding any transcoding. The structure of this property is more well-defined than the open structure of the `explicit_channel_message` property, and may be easier to use. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`.
            - `agent` Agent — Represents an agent that is involved in a conversation.
              - …
          - object — Message referring to predefined template
            - `template_message` object
              - …
            - `explicit_channel_message` object — Allows you to specify a channel and define a corresponding channel specific message payload that will override the standard Conversation API message types. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The message content must be provided in a string format. You may use the [transcoding endpoint](https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Transcoding/) to help create your message. For more information about how to construct an explicit channel message for a particular channel, see that [channel's corresponding documentation](https://developers.sinch.com/docs/conversation/channel-support/) (for example, using explicit channel messages with [the WhatsApp channel](https://developers.sinch.com/docs/conversation/channel-support/whatsapp/message-support/#explicit-channel-messages)).
            - `explicit_channel_omni_message` object — Override the message's content for specified channels. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The content defined under the specified channel will be sent on that channel.
            - `channel_specific_message` object — Channel specific messages, overriding any transcoding. The structure of this property is more well-defined than the open structure of the `explicit_channel_message` property, and may be easier to use. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`.
            - `agent` Agent — Represents an agent that is involved in a conversation.
              - …
          - object — A message containing only text.
            - `text_message` object
              - …
            - `explicit_channel_message` object — Allows you to specify a channel and define a corresponding channel specific message payload that will override the standard Conversation API message types. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The message content must be provided in a string format. You may use the [transcoding endpoint](https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Transcoding/) to help create your message. For more information about how to construct an explicit channel message for a particular channel, see that [channel's corresponding documentation](https://developers.sinch.com/docs/conversation/channel-support/) (for example, using explicit channel messages with [the WhatsApp channel](https://developers.sinch.com/docs/conversation/channel-support/whatsapp/message-support/#explicit-channel-messages)).
            - `explicit_channel_omni_message` object — Override the message's content for specified channels. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The content defined under the specified channel will be sent on that channel.
            - `channel_specific_message` object — Channel specific messages, overriding any transcoding. The structure of this property is more well-defined than the open structure of the `explicit_channel_message` property, and may be easier to use. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`.
            - `agent` Agent — Represents an agent that is involved in a conversation.
              - …
          - object — A message containing a list of options to choose from. All items must be of the same type.
            - `list_message` object
              - …
            - `explicit_channel_message` object — Allows you to specify a channel and define a corresponding channel specific message payload that will override the standard Conversation API message types. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The message content must be provided in a string format. You may use the [transcoding endpoint](https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Transcoding/) to help create your message. For more information about how to construct an explicit channel message for a particular channel, see that [channel's corresponding documentation](https://developers.sinch.com/docs/conversation/channel-support/) (for example, using explicit channel messages with [the WhatsApp channel](https://developers.sinch.com/docs/conversation/channel-support/whatsapp/message-support/#explicit-channel-messages)).
            - `explicit_channel_omni_message` object — Override the message's content for specified channels. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The content defined under the specified channel will be sent on that channel.
            - `channel_specific_message` object — Channel specific messages, overriding any transcoding. The structure of this property is more well-defined than the open structure of the `explicit_channel_message` property, and may be easier to use. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`.
            - `agent` Agent — Represents an agent that is involved in a conversation.
              - …
          - object — Message containing contact information.
            - `contact_info_message` object
              - …
            - `explicit_channel_message` object — Allows you to specify a channel and define a corresponding channel specific message payload that will override the standard Conversation API message types. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The message content must be provided in a string format. You may use the [transcoding endpoint](https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Transcoding/) to help create your message. For more information about how to construct an explicit channel message for a particular channel, see that [channel's corresponding documentation](https://developers.sinch.com/docs/conversation/channel-support/) (for example, using explicit channel messages with [the WhatsApp channel](https://developers.sinch.com/docs/conversation/channel-support/whatsapp/message-support/#explicit-channel-messages)).
            - `explicit_channel_omni_message` object — Override the message's content for specified channels. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`. The content defined under the specified channel will be sent on that channel.
            - `channel_specific_message` object — Channel specific messages, overriding any transcoding. The structure of this property is more well-defined than the open structure of the `explicit_channel_message` property, and may be easier to use. The key in the map must point to a valid conversation channel as defined in the enum `ConversationChannel`.
            - `agent` Agent — Represents an agent that is involved in a conversation.
              - …
        - `accept_time` string, date-time — The time Conversation API processed the message.
        - `channel_identity` ChannelIdentity — A unique identity of message recipient on a particular channel. For example, the channel identity on SMS, WHATSAPP or VIBERBM is a MSISDN phone number.
          - `app_id` string — Required if using a channel that uses app-scoped channel identities. Currently, FB Messenger, Instagram, LINE, and WeChat use app-scoped channel identities, which means contacts will have different channel identities on different Conversation API apps. These can be thought of as virtual identities that are app-specific and, therefore, the app_id must be included in the API call.
          - `channel` 'SMS' | 'RCS' | 'WHATSAPP' | 'MMS' | 'KAKAOTALK' | 'KAKAOTALKCHAT' | 'VIBERBM' | 'LINE' | 'INSTAGRAM' | 'MESSENGER' | 'WECHAT' | 'TELEGRAM' | 'APPLEBC', required — The identifier of the channel you want to include. Must be one of the enum values.
          - `identity` string, required — The channel identity. This will differ from channel to channel. For example, a phone number for SMS, WhatsApp, and Viber Business.
        - `contact_id` string — The ID of the contact.
        - `conversation_id` string — The ID of the conversation.
        - `direction` 'TO_APP' | 'TO_CONTACT' — The direction of the message flow, indicating whether the message was sent to or from the Conversation API app.
        - `id` string — The ID of the message.
        - `metadata` string — Optional. Metadata associated with the contact. Up to 1024 characters long.
        - `injected` boolean — Flag for whether this message was injected.
        - `sender_id` string — For Contact Messages (MO messages), the sender ID represents the recipient to which the message was sent. This may be a phone number (in the case of SMS and MMS) or a unique ID (in the case of WhatsApp). This is field is not supported on all channels, nor is it supported for MT messages.
        - `processing_mode` 'CONVERSATION' | 'DISPATCH' — Whether or not Conversation API should store contacts and conversations for the app. For more information, see [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/).
      - object — A message on a particular channel.
        - `contact_message` union
          - object — If the contact message was a response to a previous App message then this field contains information about that.
            - `channel_specific_message` object
              - …
            - `reply_to` object
              - …
          - object — If the contact message was a response to a previous App message then this field contains information about that.
            - `choice_response_message` object
              - …
            - `reply_to` object
              - …
          - object — If the contact message was a response to a previous App message then this field contains information about that.
            - `fallback_message` object
              - …
            - `reply_to` object
              - …
          - object — If the contact message was a response to a previous App message then this field contains information about that.
            - `location_message` object
              - …
            - `reply_to` object
              - …
          - object — If the contact message was a response to a previous App message then this field contains information about that.
            - `media_card_message` object
              - …
            - `reply_to` object
              - …
          - object — If the contact message was a response to a previous App message then this field contains information about that.
            - `media_message` MediaProperties
              - …
            - `reply_to` object
              - …
          - object — If the contact message was a response to a previous App message then this field contains information about that.
            - `product_response_message` object
              - …
            - `reply_to` object
              - …
          - object — If the contact message was a response to a previous App message then this field contains information about that.
            - `text_message` object
              - …
            - `reply_to` object
              - …
        - `accept_time` string, date-time — The time Conversation API processed the message.
        - `channel_identity` ChannelIdentity — A unique identity of message recipient on a particular channel. For example, the channel identity on SMS, WHATSAPP or VIBERBM is a MSISDN phone number.
          - `app_id` string — Required if using a channel that uses app-scoped channel identities. Currently, FB Messenger, Instagram, LINE, and WeChat use app-scoped channel identities, which means contacts will have different channel identities on different Conversation API apps. These can be thought of as virtual identities that are app-specific and, therefore, the app_id must be included in the API call.
          - `channel` 'SMS' | 'RCS' | 'WHATSAPP' | 'MMS' | 'KAKAOTALK' | 'KAKAOTALKCHAT' | 'VIBERBM' | 'LINE' | 'INSTAGRAM' | 'MESSENGER' | 'WECHAT' | 'TELEGRAM' | 'APPLEBC', required — The identifier of the channel you want to include. Must be one of the enum values.
          - `identity` string, required — The channel identity. This will differ from channel to channel. For example, a phone number for SMS, WhatsApp, and Viber Business.
        - `contact_id` string — The ID of the contact.
        - `conversation_id` string — The ID of the conversation.
        - `direction` 'TO_APP' | 'TO_CONTACT' — The direction of the message flow, indicating whether the message was sent to or from the Conversation API app.
        - `id` string — The ID of the message.
        - `metadata` string — Optional. Metadata associated with the contact. Up to 1024 characters long.
        - `injected` boolean — Flag for whether this message was injected.
        - `sender_id` string — For Contact Messages (MO messages), the sender ID represents the recipient to which the message was sent. This may be a phone number (in the case of SMS and MMS) or a unique ID (in the case of WhatsApp). This is field is not supported on all channels, nor is it supported for MT messages.
        - `processing_mode` 'CONVERSATION' | 'DISPATCH' — Whether or not Conversation API should store contacts and conversations for the app. For more information, see [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/).
  - `next_page_token` string — Token that should be included in the next request to fetch the next page.

## Other responses

- `400` — Malformed request. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
- `401` — Incorrect credentials. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
- `403` — Correct credentials but you don't have access to the requested resource. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
- `500` — Correct credentials but you don't have access to the requested resource. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.
- `501` — Something went wrong on our end, try again with exponential back-off. See [common error responses](https://developers.sinch.com/docs/conversation/api-reference/#common-error-responses) for more information.

---

[API](https://skmtc.net/sinch/apis/conversation-api-sinch.md) · [All operations](https://skmtc.net/sinch/apis/conversation-api-sinch/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sinch/conversation-api-sinch/revisions/bdb3e0c48bf7/schema)
