# Get Messages

Retrieve all messages from a specific chatlog, including both user messages and bot responses with timestamps.

## Endpoint

```
POST https://app.wonderchat.io/api/v1/messages
```

## Request Parameters

| Parameter   | Type   | Required | Description                                     |
| ----------- | ------ | -------- | ----------------------------------------------- |
| `apiKey`    | string | ✅ Yes    | Your API key                                    |
| `chatlogId` | string | ✅ Yes    | The ID of the chatlog to retrieve messages from |

## Example Request

```bash
curl --location --request POST 'https://app.wonderchat.io/api/v1/messages' \
--header 'Content-Type: application/json' \
--data-raw '{
  "apiKey": "YOUR_API_KEY",
  "chatlogId": "YOUR_CHATLOG_ID"
}'
```

## Response Format

```json
{
  "messages": [
    {
      "content": "Hello, how can I help you?",
      "type": "bot",
      "createdAt": "2023-12-01T06:34:38.903Z"
    },
    {
      "content": "I have a question about your product.",
      "type": "user",
      "createdAt": "2023-12-01T06:35:10.123Z"
    },
    {
      "content": "I'd be happy to help you with product information. What specifically would you like to know?",
      "type": "bot",
      "createdAt": "2023-12-01T06:35:15.456Z"
    }
  ]
}
```

## Response Fields

| Field                  | Type   | Description                                |
| ---------------------- | ------ | ------------------------------------------ |
| `messages`             | array  | Array of all messages in the chatlog       |
| `messages[].content`   | string | The text content of the message            |
| `messages[].type`      | string | Message type: `"user"` or `"bot"`          |
| `messages[].createdAt` | string | ISO timestamp when the message was created |

## Message Types

| Type   | Description                       |
| ------ | --------------------------------- |
| `user` | Message sent by the user/customer |
| `bot`  | Response generated by the chatbot |

## Use Cases

* **Conversation Review**: Analyze individual conversations for quality assurance
* **Context Retrieval**: Get full conversation context for support handovers
* **Training Data**: Extract conversations for chatbot training
* **Audit Trail**: Maintain records of customer interactions
* **Integration**: Sync conversation history with CRM or support systems
* **Analytics**: Analyze conversation flow and user behavior patterns


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wonderchat.io/api-reference/messages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
