Create Message

Store a new message in a conversation. In mock mode, simulates message creation with sample data.

POST https://developers.chatway.app/api/v1/messages

Example request

curl -X POST "https://developers.chatway.app/api/v1/messages" \
  -H "X-API-KEY: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "conversation_id": "0f46c0a1-8938-40e3-b2b5-bb56f569fcab",
    "content": "Hello, I need help",
    "widget_id": "eouqtiupanm6uvglwshy",
    "type": "message",
    "agent_id": "26fa75f2-7ac1-47b4-84e1-b943491ba4da",
    "attachments": [
        {
            "url": "https://developers.chatway.app/api/v1/contacts?page=2",
            "name": "John Doe"
        }
    ]
}'

Request body

application/json

Responses

200

application/json

500

An error

application/json

422

404

Conversation not found

application/json

Examples

Request body example

{
    "conversation_id": "0f46c0a1-8938-40e3-b2b5-bb56f569fcab",
    "content": "Hello, I need help",
    "widget_id": "eouqtiupanm6uvglwshy",
    "type": "message",
    "agent_id": "26fa75f2-7ac1-47b4-84e1-b943491ba4da",
    "attachments": [
        {
            "url": "https://developers.chatway.app/api/v1/contacts?page=2",
            "name": "John Doe"
        }
    ]
}

Response 200 example

{
    "data": {
        "type": "messages",
        "id": "msg-1",
        "attributes": {
            "conversation_id": "0f46c0a1-8938-40e3-b2b5-bb56f569fcab",
            "contact_id": "9b0c5fe6-35ad-459d-b6ba-4288191f84f1",
            "agent": null,
            "contact": {
                "id": "9b0c5fe6-35ad-459d-b6ba-4288191f84f1",
                "name": "John Doe"
            },
            "origin": "chat",
            "content": "Hello, I need help",
            "type": "message",
            "created_at": "2026-02-04T10:30:00Z"
        }
    }
}