The conversation object
{
"id": "0199ed2a-…",
"channel": "whatsapp",
"customer": { "id": "…", "name": "Ana López", "phone": "50370000000" },
"mode": "human",
"needsAttention": true,
"lastMessageAt": "2026-10-12T15:04:05.000Z",
"lastMessagePreview": "¿Tienen talla L?",
"assignedUserId": null
}| Field | |
|---|---|
mode |
bot (the AI answers), human (your team answers) or closed. |
needsAttention |
The bot handed off, or the customer wrote while in human mode. |
The message object
{
"id": "0199ed2b-…",
"direction": "inbound",
"sender": "customer",
"content": "¿Tienen talla L?",
"messageType": "text",
"mediaUrl": null,
"status": null,
"createdAt": "2026-10-12T15:04:05.000Z"
}direction is inbound (from the customer) or outbound. mediaUrl is a short-lived signed URL for images, audio and documents. status reports delivery of outbound messages: sent, delivered, read or failed.
GET/conversations
Most recent activity first.
| Query | |
|---|---|
filter |
attention, bot, human or closed. |
q |
Customer name or phone. |
ids |
Comma-separated ids (up to 50). |
limit |
1–100, default 20. |
cursor |
From the previous page. |
The response is { "items": [...], "nextCursor": ... }; the SDK returns it as data.
const { data } = await malla.conversations.list({ filter: 'attention' })GET/conversations/:id
The conversation with its customer and the cart the bot is building, if any.
PATCH/conversations/:id
Take over a conversation, hand it back to the bot, close it, or clear the attention flag.
await malla.conversations.update(id, { mode: 'human' })
await malla.conversations.update(id, { needsAttention: false })GET/conversations/:id/messages
Newest first. Pass after (a message id) to get only newer messages, e.g. to catch up. limit defaults to 30.
const { data: messages } = await malla.conversations.listMessages(id, { limit: 50 })POST/conversations/:id/messages
Sends a text reply (up to 4,096 characters) as your business. Answers 201 with the message.
curl -X POST "https://api.malla.fun/conversations/CONVERSATION_ID/messages" \
-H "Authorization: Bearer $MALLA_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "text": "¡Sí! Te aparto una talla L." }'await malla.conversations.sendMessage(id, '¡Sí! Te aparto una talla L.')Related events: message.received, conversation.needs_attention.