Get conversation context for a contact
Return the last N messages for a contact in chronological order (oldest → newest). The response contains two views: - `messages`: raw message rows ready to map into an LLM chat array. - `formatted`: a single string (`ROLE: content` per line) convenient to append to a voice agent's system prompt for cross-channel continuity.
Return the last N messages for a contact in chronological order (oldest → newest).
The response contains two views:
messages: raw message rows ready to map into an LLM chat array.formatted: a single string (ROLE: contentper line) convenient to append to a voice agent's system prompt for cross-channel continuity.
Authorization
BearerAuth API key authentication. Get your key from the dashboard.
In: header
Query Parameters
External contact identifier (phone, session id, email, …)
If provided, only messages linked to this agent are returned
uuidMaximum number of messages to include (max 200)
50value <= 200Response Body
application/json
application/json
curl -X GET "https://example.com/chats/context?contact_id=string"{
"contact_id": "string",
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"messages": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
"contact_id": "+31612345678",
"channel": "whatsapp",
"role": "user",
"content": "string",
"metadata": {
"provider_message_id": "wamid.ABC",
"attachments": []
},
"created_at": "2019-08-24T14:15:22Z"
}
],
"formatted": "USER: When does my order arrive?\nASSISTANT: Your order ships tomorrow."
}{
"error": "Invalid API key",
"message": "string"
}List chat messages GET
List chat messages for a contact, newest first. Use this for dashboards or manual inspection; use `/chats/context` when feeding history to an LLM or voice agent.
Append a chat message POST
Store a single chat message for a contact. Chats are a lightweight, developer-first storage primitive. VoiceDock keeps the messages — your application keeps the LLM logic, tools, and channel wiring (Meta Cloud API, widget, SMS gateway, etc.). Pair with `GET /chats/context` to share history between chat channels and voice agents. Messages are append-only; update by inserting a new message and delete individually via `DELETE /chats/{id}`.