Get Chat Duration
Retrieve the average duration of chat sessions based on specified criteria
Authentication
Bearer token for authentication
Path Parameters
The ID of the organization
Query Parameters
The start date for the date range filter (ISO 8601 format)
The end date for the date range filter (ISO 8601 format)
Filter results by a specific session channel
Filter results by a specific session status
Response
The average duration of chat sessions in seconds
Example Request
curl --location --request GET 'https://api-v2.opencopilot.so/backend/reports/chats/duration?startDate=2023-01-01T00:00:00Z&endDate=2023-12-31T23:59:59Z&channel=web&status=1'
Example Response
{
"average_duration": 300.5
}
This endpoint calculates the average duration of chat sessions based on the provided query parameters. It uses the difference between the created_at
and updated_at
timestamps of each session to determine the duration. The result is returned as an average in seconds.
If no query parameters are provided, it will calculate the average duration for all chat sessions for the specified organization. You can use the query parameters to filter the results by date range, channel, and status.
Was this page helpful?