---
title: "messageQuery"
description: >
  Get the message list of a specified conversation from a chat app or messaging system. These messages are sent via the [messageSend](https://developer.shopline.com/docs/storefront-api/message/mutations/message-send.md) mutation. Before you call this query, ensure that the conversation has been created using the [conversationCreate](https://developer.shopline.com/docs/storefront-api/message/mutations/conversation-create.md) mutation.
doc_type: graphql
doc_category: storefront
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/storefront-api/message/queries/message-query'
  md: 'https://developer.shopline.com/docs/storefront-api/message/queries/message-query.md'
---
# messageQuery

Get the message list of a specified conversation from a chat app or messaging system. These messages are sent via the [messageSend](https://developer.shopline.com/docs/storefront-api/message/mutations/message-send.md) mutation. Before you call this query, ensure that the conversation has been created using the [conversationCreate](https://developer.shopline.com/docs/storefront-api/message/mutations/conversation-create.md) mutation.

- **Required Scopes:** `unauthenticated_read_message`
- **API Version:** v20270301
- **API Type:** Storefront
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Required Permissions

* `unauthenticated_read_message`

An access token is required to call this API. Refer to [Authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md) for more information about how to obtain the token.

## Arguments

* `input`

  [MessageQueryInput!](https://developer.shopline.com/docs/storefront-api/message/inputs/message-query-input.md)

  The input fields to query a list of messages.

## Returns

* `messages`

  [[Message]](https://developer.shopline.com/docs/storefront-api/message/objects/message.md)

  List of messages.

## Examples

### Query messages

Retrieve the message list of a specified conversation from a chat application or messaging system. (These messages are sent via the [messageSend](https://developer.shopline.com/docs/storefront-api/message/mutations/message-send.md) mutation.) Before you call this query, ensure that the conversation has been created using the [conversationCreate](https://developer.shopline.com/docs/storefront-api/message/mutations/conversation-create.md) mutation.

**Request:**

```json


query MessageQuery {
    messageQuery(
        input: { conversationId: "gid://shopline/Conversation/******403588", direction: "down", pageSize: 10 }
    ) {
        messages {
            conversationId
            storeId
            userId
            content
            contentAttachmentUrl
            messageType
            createAt
            sendErrorCode
            senderType
            sendStatus
            id
        }
    }
}

```

**Response:**

```json
{
  "data": {
    "messageSend": {
      "userErrors": [],
      "message": {
        "content": "demoString",
        "messageType": "TEXT",
        "sendStatus": "SEND_SUCCESS",
        "userId": "gid://shopline/ThirdUser/******5235111",
        "contentAttachmentUrl": "",
        "conversationId": "gid://shopline/Conversation/******403588",
        "createTime": null,
        "id": null,
        "sendErrorCode": "",
        "senderType": "USER",
        "storeId": "******2170"
      }
    }
  }
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/storefront-api/overview.md#status-and-error-codes).

