# 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
