Count conversations
Get exact counts of the conversations the credential may read, with the same filters as List conversations plus assigneeId and kind. Break them down by operation (default), status, agent or channel.
Counts have no date window: every matching conversation counts, however old.
Example
curl "https://api.platic.ai/v2/conversations/counts?channelId=wb-123&groupBy=operation,status" \
-H "Authorization: Bearer $PLATIC_API_KEY" const { data } = await platic.conversations.counts({
channelId: "wb-123",
groupBy: ["operation", "status"],
});
console.log(data.total, data.byOperation?.supervised, data.byStatus?.active); Query parameters
All parameters are optional. List parameters take comma-separated values or the parameter repeated.
| Parameter | Type | Description |
|---|---|---|
contactId | string | Only conversations of this contact |
channelId | string | Only conversations on this channel |
agentId | string | Only conversations whose main agent is this one |
platform | string | Only conversations on this platform: whatsapp, instagram, facebook, email, webchat… |
status | string | Only these visible states: initiated, active, finished, archived, spam |
operation | string | Only these operations: automatic, supervised, assistance |
tags | string | Tag names, up to 10. A conversation counts when it has any of them |
assigneeId | string | Only conversations assigned to this team member (member ID or email) or to team |
kind | string | chat (default): conversations. post: comment posts. all: both |
groupBy | string | Breakdowns to return: operation, status, agent, channel. Up to all four. Default: operation |
workspace | string | The workspace to read, for an API key that covers several. Other credentials always read their own workspace |
Response
{
"status": "success",
"data": {
"total": 1234,
"totalRelation": "exact",
"byOperation": { "automatic": 900, "supervised": 300, "assistance": 34 },
"byStatus": { "active": 400, "archived": 700, "finished": 134 }
},
"meta": { "requestId": "req_7f3b" }
} | Field | Description |
|---|---|
total | Conversations that match the filters and that the credential may read |
totalRelation | Always exact |
byOperation | Count per operation (automatic, supervised, assistance). Only with groupBy=operation |
byStatus | Count per visible state (initiated, active, finished, archived, spam). Only with groupBy=status |
byAgent | Count per main agent ID. Only with groupBy=agent |
byChannel | Count per channel ID. Only with groupBy=channel |
meta.requestId | ID of the request, for support |
Only the breakdowns you ask for are returned. status and operation are explained in Status and operation.
Use counts for totals, not the results of a search. A search works on a window of candidates (see totalRelation in Search conversations); counts are exact.
Who sees what
Counts follow the same reach as the list. An OAuth connection acts as the person who authorized it: if their role only reaches assigned conversations, total and every breakdown count only conversations assigned to them or to team.
Errors
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | A query parameter is invalid, for example an unknown groupBy value or more than 10 tags. details.issues says which |
400 | INVALID_REQUEST | The workspace in ?workspace= is not covered by the credential. details.available lists the ones it covers |
400 | INVALID_FILTER | A filter has a value that cannot be applied |
401 | UNAUTHENTICATED | The credential is missing or invalid |
403 | FORBIDDEN | The credential has no access to conversations in this workspace |
503 | SEARCH_UNAVAILABLE | Counting is temporarily unavailable. details.retryable is true. Try again |
The general error format is in Errors.