---
title: "Sessions per channel"
description: "Count the sessions per communication channel with the sessions_per_channel GraphQL function to compare engagement across channels."
---

# Sessions per channel

> Count the sessions per communication channel with the sessions_per_channel GraphQL function to compare engagement across channels.

## 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

```graphql
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:**

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

## Parameters

| Parameter        | Type        | Description                       |
| ---------------- | ----------- | --------------------------------- |
| `accountId`      | `uuid`      | Account identifier                |
| `deskIds`        | `_uuid`     | Filter by desk IDs                |
| `brainIds`       | `_uuid`     | Filter by AI agent IDs            |
| `integrationIds` | `_uuid`     | Filter by integration IDs         |
| `startDate`      | `timestamp` | Start date (format: `yyyy-mm-dd`) |
| `endDate`        | `timestamp` | End date (format: `yyyy-mm-dd`)   |
| `isTest`         | `Boolean`   | Exclude test sessions             |

## Response fields

| Field     | Type     | Description        |
| --------- | -------- | ------------------ |
| `channel` | `String` | Channel name       |
| `counts`  | `Int`    | Number of sessions |

## Common use cases

## Try it

<GraphiQLPlayground
  query={`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"
}`}
  endpoint="https://logs.moveo.ai/v1/graphql"
/>

**Account overview**

Get channel distribution for an account:

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

**Specific desk**

Get channel distribution for a specific desk:

```json
{
  "accountId": "991c12a1-cc58-4377-8e37-f72259e9dac1",
  "deskIds": "{d2be0283-9b53-4d7b-b77d-2650f3a1a99c}",
  "startDate": "2024-01-08",
  "endDate": "2024-01-17"
}
```

**Production only**

Exclude test sessions:

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

## Example response

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