Messages API
Send and retrieve messages within conversations.
List Messages
GET
/v1/conversations/:id/messagescurl -X GET "https://api.chatmefy.com/v1/conversations/conv_abc/messages" \
-H "Authorization: Bearer YOUR_API_KEY"
# Response
{
"data": [
{
"id": "msg_001",
"role": "bot",
"content": "Hello! How can I help you today?",
"created_at": "2024-01-15T10:30:00Z"
},
{
"id": "msg_002",
"role": "user",
"content": "What are your pricing options?",
"created_at": "2024-01-15T10:30:15Z"
},
{
"id": "msg_003",
"role": "bot",
"content": "We offer three plans: Free, Pro, and Business...",
"created_at": "2024-01-15T10:30:18Z"
}
]
}Send Message (Agent)
Send a message as a human agent in a conversation:
POST
/v1/conversations/:id/messagescurl -X POST "https://api.chatmefy.com/v1/conversations/conv_abc/messages" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Hi! I am taking over this conversation.",
"role": "agent"
}'
# Response
{
"data": {
"id": "msg_004",
"role": "agent",
"content": "Hi! I am taking over this conversation.",
"created_at": "2024-01-15T10:35:00Z"
}
}Request Body
contentstringRequiredMessage content (max 4000 chars)rolestringOptionalagent or system (default: agent)Message Object
| Field | Type | Description |
|---|---|---|
| id | string | Unique message identifier |
| role | string | user, bot, agent, or system |
| content | string | Message text content |
| attachments | array | File attachments (if any) |
| metadata | object | Additional message data |
| created_at | ISO8601 | When message was sent |