Count conversations

SDK platic.conversations.counts()

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

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.

ParameterTypeDescription
contactIdstringOnly conversations of this contact
channelIdstringOnly conversations on this channel
agentIdstringOnly conversations whose main agent is this one
platformstringOnly conversations on this platform: whatsapp, instagram, facebook, email, webchat…
statusstringOnly these visible states: initiated, active, finished, archived, spam
operationstringOnly these operations: automatic, supervised, assistance
tagsstringTag names, up to 10. A conversation counts when it has any of them
assigneeIdstringOnly conversations assigned to this team member (member ID or email) or to team
kindstringchat (default): conversations. post: comment posts. all: both
groupBystringBreakdowns to return: operation, status, agent, channel. Up to all four. Default: operation
workspacestringThe 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" }
}
FieldDescription
totalConversations that match the filters and that the credential may read
totalRelationAlways exact
byOperationCount per operation (automatic, supervised, assistance). Only with groupBy=operation
byStatusCount per visible state (initiated, active, finished, archived, spam). Only with groupBy=status
byAgentCount per main agent ID. Only with groupBy=agent
byChannelCount per channel ID. Only with groupBy=channel
meta.requestIdID of the request, for support

Only the breakdowns you ask for are returned. status and operation are explained in Status and operation.

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

Statusdetails.codeWhen it happens
400INVALID_REQUESTA query parameter is invalid, for example an unknown groupBy value or more than 10 tags. details.issues says which
400INVALID_REQUESTThe workspace in ?workspace= is not covered by the credential. details.available lists the ones it covers
400INVALID_FILTERA filter has a value that cannot be applied
401UNAUTHENTICATEDThe credential is missing or invalid
403FORBIDDENThe credential has no access to conversations in this workspace
503SEARCH_UNAVAILABLECounting is temporarily unavailable. details.retryable is true. Try again

The general error format is in Errors.