Skip to main content

Sessions per channel

Overview​

The sessions_per_channel function provides session counts grouped by communication channel. This helps understand channel usage and distribution. Use this endpoint to:

  • Analyze channel distribution of conversations
  • Compare engagement across different channels
  • Plan channel-specific optimizations

Quick start​

query SessionsPerChannel(
$accountId: uuid
$deskIds: _uuid
$brainIds: _uuid
$integrationIds: _uuid
$startDate: timestamp
$endDate: timestamp
$isTest: Boolean
) {
rows: sessions_per_channel(
args: {
account_id: $accountId
desk_ids: $deskIds
brain_parent_ids: $brainIds
integration_ids: $integrationIds
start_time: $startDate
end_time: $endDate
is_test: $isTest
}
) {
channel
counts
}
}

Variables:

{
"accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
"startDate": "2024-01-08",
"endDate": "2024-01-17"
}

Parameters​

ParameterTypeDescription
accountIduuidAccount identifier
deskIds_uuidFilter by desk IDs
brainIds_uuidFilter by AI agent IDs
integrationIds_uuidFilter by integration IDs
startDatetimestampStart date (format: yyyy-mm-dd)
endDatetimestampEnd date (format: yyyy-mm-dd)
isTestBooleanExclude test sessions

Response fields​

FieldTypeDescription
channelStringChannel name
countsIntNumber of sessions

Common use cases​

Try it​

Loading GraphQL Playground...

Get channel distribution for an account:

{
"accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
"startDate": "2024-01-08",
"endDate": "2024-01-17"
}

Example response​

{
"data": {
"rows": [
{
"channel": "web",
"counts": 5420
},
{
"channel": "facebook",
"counts": 1820
},
{
"channel": "whatsapp",
"counts": 2350
},
{
"channel": "viber",
"counts": 890
}
]
}
}