Get SalesCoach user statistics

From docs
Jump to: navigation, search

Mobile_API »Retrieve User Statistics

Base URL

https://apimobile.callproof.com

Endpoint

/api/ai/chat-bot/user/statistics

Purpose

Returns activity counts for a user over a date range for Sales Coach and AI chatbot summary views. Counts include tasks (total, completed, and pending), contacts added, appointments, event forms, contact notes, opportunities, Twilio calls, regular calls, and Twilio SMS. By default, statistics cover the current day in the user’s timezone. Managers can request company-wide team totals instead of a single user’s totals.

HTTP Method

GET

Headers

Header Required Description
Authorization Yes Bearer access token
email No Email of the user whose statistics should be returned. If omitted or not found, statistics for the authenticated user are returned

Security

  • Yes – Requires Bearer Token authentication.

Parameters

Path Parameters

None.

Query Parameters

Parameter Type Required Description
start_date string No Start of the reporting period (`YYYY-MM-DD`). Must be provided together with `end_date`. If omitted, defaults to the start of the current day in the user’s timezone
end_date string No End of the reporting period (`YYYY-MM-DD`). Must be provided together with `start_date`. If omitted, defaults to the end of the current day in the user’s timezone
isTeam boolean No When `true` and the requested user is a manager, returns totals across all active users in the company. Otherwise returns totals for the individual user only

Request Body

None.

Success Response (200)

Field Type Description
clientStatusCode integer Application status code (`200` on success)
user_id integer Authenticated user’s ID
company_id integer Authenticated user’s company ID
data object Aggregated statistics for the selected user or team and date range
data.total_tasks integer Total tasks created in the period
data.completed_tasks integer Tasks marked completed in the period
data.pending_tasks integer Tasks not completed (or with no completion flag) in the period
data.total_contacts_added integer Contacts created in the period
data.total_appointments integer Appointments created in the period
data.total_event_forms integer Event forms submitted in the period
data.total_contact_notes integer Contact notes created in the period
data.total_opportunities integer Opportunities created in the period
data.total_twilio_calls integer Twilio calls in the period
data.total_normal_calls integer Regular (non-Twilio) calls in the period
data.total_twilio_sms integer Twilio SMS messages in the period
uri string Request URI

Example:

{
  "clientStatusCode": 200,
  "user_id": 1001,
  "company_id": 2001,
  "data": {
    "total_tasks": 12,
    "completed_tasks": 8,
    "pending_tasks": 4,
    "total_contacts_added": 3,
    "total_appointments": 5,
    "total_event_forms": 2,
    "total_contact_notes": 7,
    "total_opportunities": 1,
    "total_twilio_calls": 10,
    "total_normal_calls": 4,
    "total_twilio_sms": 6
  },
  "uri": "https://apimobile.callproof.com/api/ai/chat-bot/user/statistics"
}

Error Responses

clientStatusCode Description
400 Statistics could not be retrieved (for example, an unexpected failure while calculating counts). Message: We're sorry, but there was an issue accessing the AI Sales Coach module. Our team has been notified and is working to resolve it.
401 Missing or invalid Bearer token, expired token, or disabled user account