Send a message
Retrieve conversation history
High-level shortcut
For most use cases, useclient.chat() which handles conversation creation automatically:
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Send messages and retrieve conversation history
const result = await client.messages.send(91, {
content: "Do you ship to Lagos?",
metadata: { client_message_id: "msg_abc123" }, // optional
});
console.log(result.user_message.content); // "Do you ship to Lagos?"
console.log(result.agent_message.content); // "Yes, shipping is available."
const page = await client.messages.list(91);
for await (const message of page) {
console.log(`[${message.sender}] ${message.content}`);
}
client.chat() which handles conversation creation automatically:
const result = await client.chat({
agent_id: 7,
external_user_id: "user_12345",
message: "Do you ship to Lagos?",
});
| Field | Type | Description |
|---|---|---|
id | number | Message ID |
sender | "user" | "agent" | Who sent the message |
content | string | Message text |
tool_calls | array | Tool calls made by the agent |
metadata | object | Key-value metadata |
timestamp | string | ISO 8601 timestamp |
