Session content
Overview
The get_session_content function retrieves the full content of a specific session. Use this endpoint to:
- Access complete session conversation history
- Retrieve session metadata and user information
- Analyze message-level details and AI agent responses
Quick start
query GetSessionContent($sessionId: String!) {
get_session_content(args: { session_id: $sessionId }) {
account_id
brain_id
brain_parent_id
brain_version
channel
channel_user_id
csat_brain
csat_human_agent
desk_id
end_time
expired_time
external_user_id
feedback
goal_achieved
insights
integration_id
is_contained
is_covered
is_test
messages
participated_agents
participated_brains
participated_collections
rating
rule_ids
session_id
start_time
tags
total_user_messages
user_email
user_id
user_name
user_sentiment
}
}
Variables:
{
"sessionId": "58be4fe7-96af-409b-8ae2-cf6b1c4b51a5"
}
Try it
Loading GraphQL Playground...
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sessionId | String | Yes | Unique identifier of the session to retrieve |
startTime | timestamp | No | Start time for search window (format: ISO 8601). Adding this improves query performance |
endTime | timestamp | No | End time for search window (format: ISO 8601). Adding this improves query performance |
Response fields
Session information
| Field | Type | Description |
|---|---|---|
session_id | String | Unique session identifier |
account_id | uuid | Account identifier |
desk_id | uuid | Associated desk ID |
integration_id | uuid | Integration ID |
channel | String | Communication channel (web, facebook, viber, etc.) |
start_time | timestamp | Session start time |
end_time | timestamp | Session end time |
expired_time | timestamp | Session expiration time |
AI agent information
| Field | Type | Description |
|---|---|---|
brain_id | uuid | AI agent version ID |
brain_parent_id | uuid | AI agent parent ID |
brain_version | Int | AI agent version number |
rule_ids | Array | IDs of rules triggered during the session |
User information
| Field | Type | Description |
|---|---|---|
user_id | String | User identifier |
user_name | String | User display name |
user_email | String | User email address |
channel_user_id | String | Channel-specific user ID |
external_user_id | String | External system user ID |
Metrics and quality
| Field | Type | Description |
|---|---|---|
total_user_messages | Int | Number of user messages |
rating | Int | User rating (1-5, null if unrated) |
csat_brain | Int | Customer satisfaction score for AI agent |
csat_human_agent | Int | Customer satisfaction score for human agent |
user_sentiment | Int | User sentiment score |
goal_achieved | Int | Goal achievement status |
feedback | String | User feedback text |
insights | jsonb | Session insights data |
Session properties
| Field | Type | Description |
|---|---|---|
is_contained | Boolean | Session handled entirely by AI |
is_covered | Boolean | Session topics within AI scope |
is_test | Boolean | Test/preview session |
tags | Array | Associated tags |
participated_agents | Array | Human agents involved (null if none) |
participated_brains | Array | AI agents involved with details (brain_id, brain_version, brain_parent_id) |
participated_collections | Array | Knowledge base collection IDs used |
Messages
| Field | Type | Description |
|---|---|---|
messages | Array | Array of message objects in the session |
Each message object contains:
| Field | Type | Description |
|---|---|---|
time | timestamp | Message timestamp |
event | String | Event type (message:received, message:brain_send, session:expired, etc.) |
message | Object | Message content and metadata |
agent_id | uuid | Human agent ID (if applicable) |
brain_id | uuid | AI agent ID that processed the message |
brain_version | Int | AI agent version |
brain_parent_id | uuid | AI agent parent ID |
request_id | uuid | Request identifier |
response_time | Float | Response time in seconds |
tags | Array | Tags associated with this message |
reaction | String | User reaction (thumbs up/down) |
rule_ids | Array | Rules triggered by this message |
collection_id | uuid | Knowledge base collection ID used |
collection_sources | Array | Sources from knowledge base |
collection_request_code | String | Knowledge base request status code |
collection_response_code | String | Knowledge base response status code |
first_message | Boolean | Whether this is the first message |
new_brain_session | Boolean | Whether a new AI agent session started |
corrections | Object | Any corrections applied |
context | Object | Context data |
Common use cases
- Simple query
- With time range
Get session content by session ID:
{
"sessionId": "58be4fe7-96af-409b-8ae2-cf6b1c4b51a5"
}
Add time range for faster query execution:
{
"sessionId": "58be4fe7-96af-409b-8ae2-cf6b1c4b51a5",
"startTime": "2024-01-06T07:00:00.000Z",
"endTime": "2024-01-06T09:00:00.000Z"
}
Example response
{
"data": {
"get_session_content": [
{
"account_id": "8fb5d9d4-c3f0-4165-a8e9-41655e0fe624",
"brain_id": "21f45e59-feab-445b-a133-0bb5bf26912f",
"brain_parent_id": "21f45e59-feab-445b-a133-0bb5bf26912f",
"brain_version": 0,
"channel": "web",
"channel_user_id": null,
"csat_brain": null,
"csat_human_agent": null,
"desk_id": "4168c7cf-1ffc-4f2d-92f9-c5b9d7b2e4ff",
"end_time": "2024-01-06T07:34:44.286",
"expired_time": "2024-01-06T08:34:42.268",
"external_user_id": null,
"feedback": null,
"goal_achieved": null,
"insights": null,
"integration_id": "92b8a685-9c06-4728-8f0e-446dbd7832d7",
"is_contained": true,
"is_covered": true,
"is_test": false,
"messages": [
{
"time": "2024-01-06T07:34:43.252",
"event": "message:received",
"message": {
"text": "hi"
},
"brain_id": "21f45e59-feab-445b-a133-0bb5bf26912f",
"brain_version": 0,
"first_message": false,
"response_time": null
},
{
"time": "2024-01-06T07:34:44.286",
"event": "message:brain_send",
"message": {
"responses": [
{
"text": "Hello! How can I help you?",
"type": "text"
}
]
},
"brain_id": "21f45e59-feab-445b-a133-0bb5bf26912f",
"first_message": true,
"response_time": 0.017233333
}
],
"participated_agents": null,
"participated_brains": [
{
"brain_id": "21f45e59-feab-445b-a133-0bb5bf26912f",
"brain_version": 0,
"brain_parent_id": "21f45e59-feab-445b-a133-0bb5bf26912f"
}
],
"participated_collections": null,
"rating": null,
"rule_ids": ["b9b671b4-e4e1-401a-82d3-38a294f16fdd"],
"session_id": "cd0c20e2-338d-485f-91ca-cb34766d1ceb",
"start_time": "2024-01-06T07:34:37.346",
"tags": ["kg"],
"total_user_messages": 1,
"user_email": "test@test.com",
"user_id": "XpoawAK5aGz2-SDHlo6aT",
"user_name": "Visitor 41",
"user_sentiment": null
}
]
}
}