V 2.0
Agent Profile
Description
This API documentation provides endpoints for managing agent activities in a call center environment. It includes functionality for checking agent break status, updating ping time for agent activity monitoring, and managing wrap-up status after calls. These endpoints are specifically designed for agent-level operations and require proper authentication either through SSID or token-based methods.
Base URL
The base URL for all API endpoints is: deepcall/api/v2/agentProfile
Error Codes
Error Code | Message | Description |
---|---|---|
1501 | Agent id not match | Occurs when the provided agent ID doesn't match with the authenticated agent |
1502 | On break is : 0 | Returned when trying to access break status for an agent who is not on break |
1503 | SSID not valid for setWebPingTime | Invalid session ID provided for updating web ping time |
1504 | Agent not in wrap time | Returned when checking wrap-up status for an agent not in wrap-up mode |
1505 | Missing required parameters:mic_perm | Required parameters are missing in the request |
1506 | Cannot update [ping_time] as it is of incompatible type | Error in updating ping time due to data type mismatch |
Tags
Endpoint
-
Method: POST
-
Path:
deepcall/api/v2/agentProfile/tags
Description
The Tags API endpoint is designed to retrieve user-specific notification tags within a specific time window. It supports both user and agent-based tag retrieval, with flexible time-based filtering.
Purpose
This API helps in fetching recent notification tags for a user or agent, providing detailed information about call-related notifications with additional icon and action details.
Request Parameters
Headers
-
Content-Type
:application/json
Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
ssid |
String | Yes | Session Identifier for authentication and user context |
ref |
String | Optional | Reference flag to control time-based filtering of notifications |
Key Functionality
- Validates user session using provided SSID
- Retrieves notifications within a dynamic time window
- Supports both user and agent-based notifications
- Fetches additional icon and action details for notifications
Time Window Calculation
- Uses current timestamp for filtering
- Reference flag (
ref
) influences time range calculation - Default time window is 1 hour before current time
- Adapts time range based on previous session timestamps
Data Retrieval Process
- Authenticate user via SSID
- Retrieve user package information from Redis
- Connect to appropriate MongoDB database
- Query notifications based on user/agent ID
- Fetch additional icon details from summary collection
- Return consolidated notification data
Potential Use Cases
- Real-time notification tracking
- Call center activity monitoring
- User engagement tracking
- Agent performance analysis
Possible Error Scenarios
Error Code | Message | Scenario |
---|---|---|
1000 | Invalid Parameters | Missing or invalid SSID |
1032 | Error Getting DB Details | Database connection failure |
1044 | SSID File Not Exist | Session management issue |
1009 | Something Went Wrong | Unexpected system error |
Security and Permissions
- Requires valid authenticated session
- Differentiates between user and agent access
- Implements time-based data filtering for security
Performance Considerations
- Uses Redis for quick user package lookup
- Performs efficient MongoDB queries
- Supports concurrent icon detail retrieval
- Minimal time window for notification fetching
Recommended Integration
- Implement robust error handling
- Cache session information
- Use efficient connection pooling
- Implement proper logging for tracking
Scalability
- Designed to handle multiple concurrent requests
- Supports flexible user and agent notification retrieval
- Minimizes data transfer by focusing on recent notifications
Tags
var axios = require('axios');
var data = '{"ssid":"{{agentssid}}","ref":true}';
var config = {
method: 'post',
url: '{{brand}}/api/v2/agentProfile/tags',
headers: {
'Content-Length': ''
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
setUrl('{{brand}}/api/v2/agentProfile/tags');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Length' => ''
));
$request->setBody('{"ssid":"{{agentssid}}","ref":true}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
import http.client
conn = http.client.HTTPSConnection("{{brand}}")
payload = "{\"ssid\":\"{{agentssid}}\",\"ref\":true}"
headers = {
'Content-Length': ''
}
conn.request("POST", "/api/v2/agentProfile/tags", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var client = new RestClient("{{brand}}/api/v2/agentProfile/tags");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = @"{" + "\n" +
@" ""ssid"":""{{agentssid}}""," + "\n" +
@" ""ref"":true" + "\n" +
@"}";
request.AddParameter("text/plain", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
curl --location -g --request POST '{{brand}}/api/v2/agentProfile/tags' \
--data-raw '{
"ssid":"{{agentssid}}",
"ref":true
}'
var request = http.Request('POST', Uri.parse('{{brand}}/api/v2/agentProfile/tags'));
request.body = '''{\n "ssid":"{{agentssid}}",\n "ref":true\n}''';
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "%7B%7Bbrand%7D%7D/api/v2/agentProfile/tags"
method := "POST"
payload := strings.NewReader(`{
"ssid":"{{agentssid}}",
"ref":true
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
POST /api/v2/agentProfile/tags HTTP/1.1
Host: {{brand}}
Content-Length: 46
{
"ssid":"{{agentssid}}",
"ref":true
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\n \"ssid\":\"{{agentssid}}\",\n \"ref\":true\n}");
Request request = new Request.Builder()
.url("{{brand}}/api/v2/agentProfile/tags")
.method("POST", body)
.addHeader("Content-Length", "")
.build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Content-Length", "");
var raw = "{\n \"ssid\":\"{{agentssid}}\",\n \"ref\":true\n}";
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("{{brand}}/api/v2/agentProfile/tags", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "%7B%7Bbrand%7D%7D/api/v2/agentProfile/tags");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Length: ");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "{\n \"ssid\":\"{{agentssid}}\",\n \"ref\":true\n}";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
#import
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"%7B%7Bbrand%7D%7D/api/v2/agentProfile/tags"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Length": @""
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\n \"ssid\":\"{{agentssid}}\",\n \"ref\":true\n}" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
open Lwt
open Cohttp
open Cohttp_lwt_unix
let postData = ref "{\n \"ssid\":\"{{agentssid}}\",\n \"ref\":true\n}";;
let reqBody =
let uri = Uri.of_string "%7B%7Bbrand%7D%7D/api/v2/agentProfile/tags" in
let headers = Header.init ()
|> fun h -> Header.add h "Content-Length" ""
in
let body = Cohttp_lwt.Body.of_string !postData in
Client.call ~headers ~body `POST uri >>= fun (_resp, body) ->
body |> Cohttp_lwt.Body.to_string >|= fun body -> body
let () =
let respBody = Lwt_main.run reqBody in
print_endline (respBody)
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Length", "")
$body = "{`n `"ssid`":`"{{agentssid}}`",`n `"ref`":true`n}"
$response = Invoke-RestMethod '{{brand}}/api/v2/agentProfile/tags' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json
require "uri"
require "net/http"
url = URI("{{brand}}/api/v2/agentProfile/tags")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Length"] = ""
request.body = "{\n \"ssid\":\"{{agentssid}}\",\n \"ref\":true\n}"
response = http.request(request)
puts response.read_body
printf '{
"ssid":"{{agentssid}}",
"ref":true
}'| http --follow --timeout 3600 POST '{{brand}}/api/v2/agentProfile/tags' \
Content-Length:
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n \"ssid\":\"{{agentssid}}\",\n \"ref\":true\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "{{brand}}/api/v2/agentProfile/tags")!,timeoutInterval: Double.infinity)
request.addValue("", forHTTPHeaderField: "Content-Length")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Example Response
[{"key":"Date"
"value":"Mon
25 Nov 2024 11:09:53 GMT"}
{"key":"Content-Type"
"value":"application\/json; charset=utf-8"}
{"key":"Content-Length"
"value":"58"}
{"key":"Connection"
"value":"keep-alive"}
{"key":"Access-Control-Allow-Origin"
"value":"*"}
{"key":"Access-Control-Allow-Methods"
"value":"POST
GET
OPTIONS
PATCH
DELETE"}
{"key":"Access-Control-Allow-Headers"
"value":"X-Requested-With
content-type"}
{"key":"Access-Control-Allow-Credentials"
"value":"true"}
{"key":"Vary"
"value":"Origin"}
{"key":"ETag"
"value":"W\/\"3a-8WOAUBzAGlFeiOH3bkFLeg6mfU4\""}
{"key":"Strict-Transport-Security"
"value":"max-age=31536000; includeSubDomains"}]
{
"data": [],
"iconDetails": [],
"status": "success",
"code": 200
}