HomeVICIdial TutorialsVICIdial Non Agent API TutorialsExtracting Agent Statistics Over a Time Period Using agent_stats_export API in VICIdial

Extracting Agent Statistics Over a Time Period Using agent_stats_export API in VICIdial

Monitoring agent performance is crucial for call centers, contact centers, and outbound sales teams to ensure efficiency, optimize workforce allocation, and improve overall service quality. VICIdial, a leading open-source call center solution, provides an API function called agent_stats_export API, which enables administrators to fetch detailed agent performance reports over a specific time period.

Instead of manually exporting agent reports from the VICIdial admin panel, this API allows for automated extraction of agent statistics, integration with external reporting tools, and real-time performance tracking.

Why Use the agent_stats_export API?

Retrieve agent call statistics for a custom time period
Monitor productivity metrics such as talk time, pause time, and dispo count
Generate real-time performance reports for management and HR teams
Automate agent performance tracking without manual intervention
Integrate agent data into CRM and workforce analytics platforms

In this tutorial, we will cover:
🔹 How the agent_stats_export API works
🔹 How to configure and authenticate API access
🔹 How to construct and send API requests
🔹 Examples using a browser, cURL, and Postman
🔹 How to interpret API responses and troubleshoot errors
🔹 Best practices for using the agent_stats_export API efficiently

Let’s dive in! 🚀


Understanding the agent_stats_export API Function

The agent_stats_export API allows administrators to retrieve detailed agent performance data over a specific date range. This includes key metrics such as call count, talk time, pause time, dispo count, login duration, and more.

What Information Does the agent_stats_export API Provide?

Agent ID – The unique identifier for the agent
Total Calls Handled – The number of inbound and outbound calls processed
Total Talk Time – The duration spent talking to customers
Pause Time – The time spent in a paused state
Login Duration – The total time logged into VICIdial
Disposition Count – Number of calls marked with different outcomes
Average Talk Time per Call – Efficiency metric for agent performance
Wrap-up Time – Time spent after a call before moving to the next one

Common Use Cases for agent_stats_export API

🔹 Supervisors tracking individual and team agent performance
🔹 Generating agent efficiency reports for HR and management
🔹 Automating daily, weekly, or monthly performance exports
🔹 Integrating VICIdial agent stats with workforce analytics platforms
🔹 Identifying top-performing and underperforming agents


Step 1: Prerequisites for Using the API

Before using the agent_stats_export API, ensure you have:

VICIdial installed and configured
An API-enabled user account with administrative permissions**
A valid date range for exporting agent statistics
VICIdial server access credentials

How to Enable API Access in VICIdial

1️⃣ Log in to the VICIdial Admin Panel
2️⃣ Navigate to Admin > Users
3️⃣ Select the user who will access the API
4️⃣ Set API Access to 1 (Enabled)
5️⃣ Set User Level to 8 or higher** (Admin-level access) 6️⃣ Add agent_stats_exportto the **Allowed API Functions** (or set toALL`)
7️⃣ Click Save Changes

Now, your user is authorized to retrieve agent statistics dynamically using the API.


Step 2: Constructing the API Request

The VICIdial API uses HTTP GET requests, meaning you can access it via a browser, cURL, or API tools like Postman.

Base API URL

arduino
http://your-vicidial-server/vicidial/non_agent_api.php

🔹 Replace your-vicidial-server with your actual VICIdial instance.

Required Parameters for agent_stats_export API

Parameter Description Example
function Specifies the API function (agent_stats_export) agent_stats_export
user VICIdial API username admin
pass VICIdial API password 1234
source Identifier for tracking API calls AgentStatsReport
start_date The start date for the report (YYYY-MM-DD) 2024-02-01
end_date The end date for the report (YYYY-MM-DD) 2024-02-10
group (Optional) Filter results by a user group SALES_TEAM

Step 3: Sending the API Request

Method 1: Exporting Agent Statistics via a Web Browser

Simply enter the following URL in your browser (replace credentials accordingly):

pgsql
http://your-vicidial-server/vicidial/non_agent_api.php?function=agent_stats_export&user=admin&pass=1234&source=AgentStatsReport&start_date=2024-02-01&end_date=2024-02-10&group=SALES_TEAM

🔹 Press Enter, and the API should return the exported agent statistics.


Method 2: Exporting Agent Statistics via cURL (Command Line)

For developers, cURL is a convenient tool for making API requests. Use the following command:

bash
curl -X GET "http://your-vicidial-server/vicidial/non_agent_api.php?function=agent_stats_export&user=admin&pass=1234&source=AgentStatsReport&start_date=2024-02-01&end_date=2024-02-10&group=SALES_TEAM"

🔹 This will return detailed agent statistics for the specified time period.


Method 3: Exporting Agent Statistics via Postman

1️⃣ Open Postman
2️⃣ Set the request type to GET
3️⃣ Enter the API URL
4️⃣ Click Send
5️⃣ The response should display the exported agent performance data


Step 4: Understanding API Responses

If the request is successful, VICIdial returns a response with detailed agent statistics:

yaml
1001|John Doe|35|180|2:30:00|1:15:00|45|00:02:30|00:00:30
1002|Jane Smith|28|160|2:00:00|1:00:00|40|00:02:15|00:00:25

Breaking Down the Response

Response Value Meaning
1001 Agent ID
John Doe Agent Name
35 Total calls handled
180 Total talk time (minutes)
2:30:00 Total login duration
1:15:00 Total pause time
45 Total dispo count
00:02:30 Average talk time per call
00:00:30 Average wrap-up time

Step 5: Handling Errors & Troubleshooting

Error Message Cause Solution
ERROR: USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION Insufficient API permissions Ensure user level is 8+ and API Access is enabled
ERROR: INVALID USERNAME OR PASSWORD Wrong credentials Verify API username and password
ERROR: INVALID DATE FORMAT Incorrect date format Use YYYY-MM-DD format for dates

Conclusion

The agent_stats_export API function is an essential tool for monitoring and analyzing agent performance dynamically in VICIdial. Whether you’re tracking productivity, generating reports, or integrating agent data into external platforms, this API provides quick and accurate access to agent performance metrics.

Feel free to contact us or simply start a live chat to get connected to one of our team members. Here is our contact information.

Calling from US: +1 954-990-0053
Email: office@callix.ai

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Special Offerspot_img

Must Read

spot_img
spot_img
spot_img

Related Articles - Must Read

spot_img