Conversations
A conversation is one thread of one contact on one channel: WhatsApp, Instagram, Facebook, email, web chat or a chat created through the Chat API. Its messages are read apart, page by page, and never include system events.
This reference documents Conversations V2 (/v2/conversations). Every V2 action answers the conversation as it is afterwards, says whether anything changed, and is safe to repeat.
Comment threads on Instagram and Facebook posts are not conversations: they have their own resource, Posts.
Example
# Active conversations a person is handling, with the agent's name
curl "https://api.platic.ai/v2/conversations?status=active&operation=supervised&include=agents" \
-H "Authorization: Bearer $PLATIC_API_KEY"
# The latest messages of one of them
curl "https://api.platic.ai/v2/conversations/$CONVERSATION_ID/messages?limit=20" \
-H "Authorization: Bearer $PLATIC_API_KEY" const page = await platic.conversations.list({
status: ["active"],
operation: ["supervised"],
include: ["agents"],
});
const first = page.data[0];
if (first) {
const messages = await platic.conversations.messages.list(first.id, { limit: 20 });
for (const message of messages.data) console.log(message.sender?.type, message.content);
} What you need to know
- One workspace per call. A credential acts on its workspace; an API key that covers several sends
?workspace=. - One ID.
idis always the conversation's ID. V2 never accepts a phone number or the old V1conversationIdkey. - You choose the fields.
fieldsreplaces the default fields andincluderesolves agents, channels, assignees or message authors once per response inincluded. Unknown names answer400; nothing is ignored silently. - The history is separate. Get a conversation does not return messages. List messages pages through them.
- Lists use tokens. Send
nextPageTokenaspageTokenuntil it isnull. A page can be short, or empty, and still have a token. See Pagination. - You only see what you may read. A conversation out of reach answers
404, like one that does not exist. See Who sees what.
Endpoints
Read
| Method | Endpoint | Description |
|---|---|---|
GET | /v2/conversations | List conversations with filters, sorting and field selection |
POST | /v2/conversations/search | Search by words, meaning or both, with filters |
GET | /v2/conversations/counts | Exact counts by operation, status, agent or channel |
GET | /v2/conversations/{conversationId} | Get one conversation, without its messages |
GET | /v2/conversations/{conversationId}/messages | List the visible messages of a conversation |
GET | /v2/conversations/{conversationId}/messages/{messageId} | Get one message |
Act
How IDs work
| Field | What it identifies |
|---|---|
id | The conversation. Use it in every /v2/conversations/{conversationId} call |
contactId | The contact (clients in the API). One contact can have several conversations, on different channels or with different agents |
channelId | The channel the conversation runs on |
agentId | The main agent. A subagent taking a turn does not change it; that one is activeAgentId |
legacyConversationKey | The old V1 conversationId key, a phone number or thread key on some channels. Ask for it in fields for diagnosis only: V2 never accepts it as an ID |
A message's id is Platica's own ID, never the provider's. The provider's ID is providerMessageId.
Status and operation
A conversation has two separate dimensions:
statusis its visible state:initiated,active,finished,archivedorspam.spamwins over everything; otherwise a closed conversation isarchived; otherwise it isinitiated,activeorfinished. A stored state the API does not recognize comes back asnull, with anUNKNOWN_STATUSwarning inmeta.warnings.operationsays who answers:automatic(the agent),supervised(a person) orassistance(the agent asked a person for help).
A supervised conversation is still active. Pausing and resuming change operation; finishing, archiving and reopening change status.
Who sees what
- An API key reads every conversation in its workspace.
- An OAuth connection acts as the person who authorized it, with their current permissions. If their role only reaches assigned conversations, they only see conversations assigned to them or to
team, in lists, search, counts andincluded. Any other conversation answers404 CONVERSATION_NOT_FOUND, exactly like one that does not exist. - A permission revoked or an assignment changed applies on the next call, even with a page token in hand.
- A credential without access to conversations in the workspace gets
403. Reads, including search, work with read-only credentials; actions need write access.
V1 is deprecated. The previous endpoints still work: List conversations V1, Get a conversation V1, Search conversations V1, Update a conversation V1 and Pause the agent V1. Use the version selector on each page to switch between them.