Softphone.Pro Team Dashboard API
The examples below use curl Linux utility. You can use any tool of that type you prefer.
Login and Get a Security Token
Execute the following request and show the result:
curl -d "{\"login\":\"{YOUR_EMAIL}\",\"password\":\"{YOUR_PASS}\"}" -H "Content-Type: application/json" -H "Accept: application/json, text/plain, */*" -H "Referer: https://{YOUR_TENANT}.softphone.pro/login/" -k -X POST "https://{YOUR_TENANT}.softphone.pro/login/api/auth" -v
where:
Parameter | Description | Example |
---|---|---|
{YOUR_TENANT} | Unique name of your Team dashboard. The text between https:// and the first dot. | company |
{YOUR_EMAIL} | Team Administrator's email. | admin@company.ru |
{YOUR_PASS} | Team Administrator's password. | password |
In the request result find the string that starts with
< Set-Cookie: jwt
Get the token: everything between =
symbol and ;
symbol. It is referred in the following text as {YOUR_TOKEN}.
Create a User
Execute the following request:
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer {YOUR_TOKEN}" -d "{\"usesSoftphone\":true,\"name\":\"John\",\"surname\":\"Doe\",\"email\":\"user@company.com\",\"password\":\"123456\",\"role\":\"EMPLOYEE\",\"groups\":[1,2],\"config\":\"{% include \\\"_Restrictions\\\" %}\n{% include \\\"_SipSettings\\\" %}\n{% include \\\"_Account1\\\" %}\n{% include \\\"_ACW\\\" %}\n{% include \\\"_Statuses\\\" %}\n{% include \\\"_Camera\\\" %}\n{% include \\\"_ScreenRecording\\\" %}\n{% include \\\"Default\\\" %}\"}" https://{YOUR_TENANT}.softphone.pro/api/settings/users/save
Request parameters:
Parameter | Description | Example |
---|---|---|
usesSoftphone | Whether or not User needs to use Softphone.Pro, true/false. | true |
name | User's first name (non-empty string, up to 256 symbols). | John |
surname | User's last name (non-empty string, up to 256 symbols). | Doe |
User's email. | user@company.com | |
password | User's password (non-empty string, from 6 up to 256 symbols). | 123456 |
role | User's role. |
Possible values:
|
groups |
IDs of the teams user is a part of, one or multiple divided by commas. The parameter is set in square brackets. You can see team ID in the address bar of the browser during Team configuration. |
[1] - the user is a part of the team with ID 1; [2,4,7] - the user is a part of teams with IDs 2, 4 and 7. |
manageGroups |
IDs of the teams user (with MANAGER or RESTRICTED_ADMIN role) supervises, one or multiple divided by commas. The parameter is set in square brackets. You can see team ID in the address bar of the browser during team configuration. |
[1] - the user supervises the team with ID 1; [2,4,7] - the user supervises teams with IDs 2, 4 and 7. |
config | Softphone.Pro configuration. You can find the example of configuration in the Configuration File field on the Team Dashboard user's page, on the Softphone.Pro tab. | {% include "_Restrictions" %}\n{% include "_SipSettings" %}\n{% include "_Account1" %}\n{% include "_ACW" %}\n{% include "_Statuses" %}\n{% include "_Camera" %}\n{% include "_ScreenRecording" %}\n{% include "Default" %} |
If the response is successful, you'll receive an ID of the created user as a result. You can save it to use later, to remove a user for example.
Adding multiple users
See the example of a Powershell script that creates Team Dashboard users from a csv file. Take this script or use it as a reference for adding multiple users to Team Dashboard.
The manual below and the script example were tested on Windows 10 PC. Powershell script launch should be allowed.
1. Download the archive with the script files and example data file: Add_Agents_to_Team.zip
2. Unpack the archive to your PC. It contains 3 files:
- add_agents.ps1 - PowerShell script that adds Team Dashboard users;
- add_agents.bat - bat file with Team Dashboard access credentials, replace them with your own;
- agents.csv - description of users you need to add to the Dashboard.
3. Open agents.csv. File has example data, replace it with your own. If parameter is marked as required corresponding column in CSV file can't be empty. Headers row is required.
CSV column description:
Column name | Description | Example | Is required |
---|---|---|---|
usesSP | Whether or not User needs to use Softphone.Pro. Possible values: true/false. |
true | yes |
name | User's first name (non-empty string, up to 256 symbols). | John | yes |
surname | User's last name (non-empty string, up to 256 symbols). | Doe | yes |
User email. | user@company.com | yes | |
password | User's password (non-empty string, from 6 up to 256 symbols). | 123456 | yes |
role | User's role. |
Possible values:
|
yes |
groupsIn |
IDs of the teams user is a part of, one or multiple divided by commas. You can see team ID in the address bar of the browser during Team configuration. |
1 - the user is a part of the team with ID 1; 2,4,7 - the user is a part of teams with IDs 2, 4 and 7. |
yes |
groupsMan |
IDs of the teams user (with MANAGER or RESTRICTED_ADMIN role) supervises, one or multiple divided by commas. The parameter is set in square brackets. You can see team ID in the address bar of the browser during team configuration. |
1 - the user supervises the team with ID 1; 2,4,7 - the user supervises teams with IDs 2, 4 and 7. |
no |
siplogin | User's SIP login, string, up to 256 symbols. | sip101 | no |
sippassword | User's SIP password, string, up to 256 symbols. | sippass123 | no |
sipdisplayname | User's SIP display name, string, up to 256 symbols. | sip101 | no |
sipauthname | User's SIP authorization name, string, up to 256 symbols. | sip101 | no |
ext | User's PBX extension, string, up to 256 symbols. | 101 | no |
4. Save CSV file.
When working with CSV in editors make sure semicolon (;
) is used as values separator, and not a comma.
5. Open add_agents.bat file in the text editor and set token, dashboard and filepath parameters:
- token - enter your Team Administrator token ({YOUR_TOKEN}), you got from this manual;
- dashboard - enter your Team Dashboard address as https://{YOUR_TENANT}.softphone.pro, where {YOUR_TENANT} is unique name of your Team dashboard (the text between https:// and the first dot);
- filepath - if agents.csv file is located in the same folder as script files leave the default value .\agents.csv. Otherwise set the full path to CSV file.
Save changes to the file.
6. Run add_agents.bat by double-clicking it and wait for the script to finish.
If the user was added successfully you will see a line like this:
Successfully added user #1 from csv with ID 2
Number after #
is the ordinal number of the row in CSV file (excluding headers), number after with ID
is the ID of created user.
If the user wasn't added to Team you will see this line:
Error adding user #2 from csv, got error 500 from Team Dashboard.
You will see the ordinal number of user from CSV and the error code received from Team Dashboard.
Delete a User
Execute the following request:
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer {YOUR_TOKEN}" -d "{USER_ID}" https://{YOUR_TENANT}.softphone.pro/api/settings/users/delete
Parameter | Description | Example |
---|---|---|
{USER_ID} | IDs of the users you want to remove, one or multiple divided by commas. The parameter is set in square brackets. You can see user's ID in the address bar of the browser during user configuration or in the response to the request to add a user. |
[1] - remove a user with ID 1; [2,4,7] - remove users with IDs 2, 4 and 7. |
Get list of users
Execute the following request:
curl -H "Authorization: Bearer {YOUR_TOKEN}" -k -X GET "https://{YOUR_TENANT}.softphone.pro/api/settings/users?sortColumn=name&sortDirection=asc&pageSize=5&pageNumber=3&allUsers=true"
Request parameters:
Parameter | Description | Example |
---|---|---|
sortColumn |
Parameter to sort the list by. Possible values:
|
name |
sortDirection |
Defines the direction to sort the list by sortColumn value. Possible values: asc (ascending), desc (descending). Default value: desc. |
asc |
pageSize |
The number of users in the page of response. Default value: 20. |
5 |
pageNumber |
Page number, up from 1. Default value: 1. |
3 |
allUsers |
Return the list of all users. Possible values: true/false. Default value: false. If true, the request ignores pageSize and pageNumber values and returns the list containing all users.
|
true |
JSON with user data is sent in response. Response fields description:
Parameter | Description |
---|---|
totalCount | The number of users in the Team Dashboard. |
users | Array of users. |
users.id | User ID. |
users.name | User's first name. |
users.surname | User's last name. |
users.email | User email. |
users.state |
User status. Possible values:
|
users.role |
User role. Possible values:
|
users.groups | Array with team names the user is a part of. |
users.sfversion | Softphone.Pro version last used by the user. May be empty if user doesn't use Softphone.Pro or never logged into Team from the app. |
Get Agents Status Log
Execute the following request:
curl.exe -b "jwt={YOUR_TOKEN}" -k -X GET "https://{YOUR_TENANT}.softphone.pro/api/reports/agents/worktime/raw?from=2019-01-01T00:00:00&to=2020-01-02T00:00:00&format=csv"
Request parameters:
Parameter | Description | Example |
---|---|---|
from | Date and time in UTC format to get the status log from. | 2019-01-01T00:00:00 |
to | Date and time in UTC format to get the status log until. | 2019-12-31T23:59:59 |
format | The format of received data. Optional parameter. | csv or tsv |
Get Call Log
Execute the following request:
curl.exe -b "jwt={YOUR_TOKEN}" -k -X GET "https://{YOUR_TENANT}.softphone.pro/api/history/calls/export?dateFrom=2021-10-13T00:00:00%2B05:00&dateTo=2021-10-14T00:00:00%2B05:00&localTimeZoneOffset=%2B300&typeFile=csv"
Request parameters:
Parameter | Description | Example |
---|---|---|
dateFrom | Date and time in UTC format to get the call log from. To set a positive offset use %2B symbol (coded + symbol), to set a negative offset use - symbol. |
2021-10-13T00:00:00%2B05:00 |
dateTo | Date and time in UTC format to get the call log until. To set a positive offset use %2B symbol (coded + symbol), to set a negative offset use - symbol. |
2021-10-14T00:00:00%2B05:00 |
localTimeZoneOffset | Time offset from UTC in minutes. To set a positive offset use %2B symbol (coded + symbol), to set a negative offset use - symbol. |
%2B180 or -300 |
lang | The language of the exported file. English (en) is the default. Optional. | ru | en |
typeFile | The format of received data. Default value is xlsx. Optional parameter. | xlsx or csv |
Upload Asterisk Queue Log to Team Dashboard
Execute the following request to upload your Asterisk call data:
curl --request POST https://{YOUR_TENANT}.softphone.pro/api/reports/asterisk/upload -H 'Authorization: Bearer {YOUR_TOKEN} ' --form 'logs=@"{YOUR_PATH_TO_FILE_QUEUELOG}"'
Request parameters:
Parameter | Description | Example |
---|---|---|
{YOUR_PATH_TO_FILE_QUEUELOG} | Full path to queue_log file on the server. |
/var/log/asterisk/queueLog |
If the request is successful you will receive the uploaded calls count in response. If you receive an error you can clear previously uploaded data and try again.
Execute the following request to remove all uploaded Asterisk data from the Team Dashboard:
curl --request POST https://{YOUR_TENANT}.softphone.pro/api/reports/asterisk/clear -H 'Authorization: Bearer {YOUR_TOKEN}'