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/messagesExample 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
conversation_id (string, required)— Conversation IDcontent (string|null)widget_id (string|null)— Widget identifier (optional)type (string|null enum: message, note, null)agent_id (string|null)— Agent ID (optional, for internal/note messages)attachments (array|null)
Responses
200
application/json
data (object, required)type (string, required)id (string, required)attributes (object, required)conversation_id (string, required)contact_id (string|null, required)agent (object|null, required)id (string|null, required)name (string|null, required)
contact (object|null, required)id (string|null, required)name (string|null, required)
origin (string, required)content (string, required)type (string, required)created_at (string|null, required)
500
An error
application/json
message (string, required)— Error overview.
422
404
Conversation not found
application/json
message (string, required)
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"
}
}
}