https://api.movidesk.com/public/v1
Telephony - No queue control
Throughout this documentation, the procedures for using the API that integrates telephone systems with Movidesk are described. It is important that before using the API, you read the documentation for the telephony module (which you can find by clicking here). For every transferred call, there should be an API call to end the call. If this is not fulfilled, the records in the database related to telephone calls will be incomplete.
Layout
Transferred call
URL: /asterisk_startTransferedCall Methods: GET
Property | Type | Size | Required | Description |
---|---|---|---|---|
token | Guid | ✓ | Movidesk API key. | |
queueId | int | 10 | ✓ | ID of the queue, must be the same as the one provided in the phone group registration in Movidesk. |
clientNumber | string | 128 | ✓ | Phone number making the call. |
id | string | 256 | ✓ | Unique identifier of the completed call. Note: It will only be possible to relate a unique call ID to a ticket. Thus, it will not be possible to associate a repeated ID with a ticket. |
branchLine | string | 128 | ✓ | Extension of the agent to which the call was transferred. |
callDate | datetime UTC | * | Date of the call receipt. The provided date must be in the format yyyy-MM-ddThh:mm and in UTC*. *If the date is not provided, the current date will be considered. | |
transferDate | datetime UTC | * | Date when the call was transferred to the agent. The provided date must be in the format yyyy-MM-ddThh:mm and in UTC*. *If the date is not provided, the current date will be considered. |
Completed Call
URL: /asterisk_completedCall Methods: GET
Property | Type | Size | Required | Description |
---|---|---|---|---|
token | Guid | ✓ | Movidesk API key. | |
id | string | 256 | ✓ | Unique identifier of the completed call. Must be the same as the one provided in the transferred call method. Note: It will only be possible to relate a unique call ID to a ticket. Therefore, it will not be possible to associate a repeated ID with a ticket. |
link | string | max | NOTE: Even if empty, this parameter must be provided. | Link to the call recording. It will be included in the description of the action of the respective ticket for the call. |
completedDate | datetime UTC | * | Date of call completion. The provided date must be in the format yyyy-MM-ddThh:mm and in UTC*. *If the date is not provided, the current date will be considered. |
Canceled/Abandoned Call
URL: /asterisk_startCanceledCall Methods: GET
Property | Type | Size | Required | Description |
---|---|---|---|---|
token | Guid | ✓ | Movidesk API key. | |
queueId | int | 10 | ✓ | ID of the queue, must be the same as the one provided in the phone group registration in Movidesk. |
clientNumber | string | 128 | ✓ | Phone number that canceled/abandoned the call. |
id | string | 256 | ✓ | Unique identifier of the canceled/abandoned call. Note: It will only be possible to relate a unique call ID to a ticket. Therefore, it will not be possible to associate a repeated ID with a ticket. |
callDate | datetime UTC | * | Date of call receipt. The provided date must be in the format yyyy-MM-ddThh:mm and in UTC*. *If the date is not provided, the current date will be considered. | |
canceledDate | datetime UTC | ✓ | Date of call cancellation/abandonment. The provided date must be in the format yyyy-MM-ddThh:mm and in UTC*. *If the date is not provided, the current date will be considered. |
Update call recording link
URL: /setMadeCallLink Methods: POST
Property | Type | Size | Required | Description |
---|---|---|---|---|
token | Guid | ✓ | Movidesk API key. | |
id | string | 256 | ✓ | Unique identifier of the completed call. It must be the same as the one provided in the received call method. Note: It will only be possible to link a unique call id to a ticket. Therefore, it will not be possible to associate a repeated id with a ticket. |
Link | string | 256 | Link to the call recording. It will be included in the description of the action for the respective ticket related to the call. |
*UTC: Coordinated Universal Time (from English Universal Time Coordinated) is the reference time zone from which all other time zones in the world are calculated. E.g., if your time zone is Brasilia (UTC-03:00) and the current time is 15:30, the UTC time will be 18:30.
Working with the data
To access the data, it is necessary to first generate a key for the API
To generate an API key (token), go to Movidesk, navigate to Settings / Account / Parameters, and in the environment tab click the "Generate new key" button if you don't already have one created.
You can repeat this operation whenever you want to generate a new access key, but remember that generating a new key will cause all programs using the old key to stop working.
Flows that should be followed
Happy scenario
Central receives a phone call -> Central transfers the call to the agent's extension and makes an API call to the asterisk_startTransferedCall method -> Movidesk automatically opens a screen for call control for the agent to whom the call was transferred -> Central identifies that the call has ended and makes an API call to the asterisk_completedCall method -> Movidesk automatically closes the screen that was open for the agent and performs the necessary procedures on the generated/associated ticket for the call.
Transferred call
GET: https://api.movidesk.com/public/v1/asterisk_startTransferedCall?token=155cac97-f203-4bb8-86e1-aa4cb8781f3e&queueId=1&clientNumber=4733990777&id=3&branchLine=5252&callDate=2018-5-1T17:00:00&transferDate=2018-5-1T17:02:00
Response: Status 200. At this moment, the call will appear in Movidesk in the ongoing call queue, and the call control screen will automatically appear for the agent with the provided extension (in the example, 5252).
Completed call
GET: https://api.movidesk.com/public/v1/asterisk_completedCall?token=155cac97-f203-4bb8-86e1-aa4cb8781f3e&id=3&link=https://www.linkdagravacaodachamada.com.br&completedDate=2018-5-1T17:20:00
Response: Status 200. At this moment, the call will be removed from Movidesk's queues, and the call control screen will be automatically closed. The action with the call recording will be added to the ticket related to the call.
Alternative scenario
- Central receives a phone call -> Central considers the call as canceled/abandoned and makes an API call to the asterisk_startCanceledCall method -> Movidesk automatically generates a ticket with the origin of the canceled call and generates an action on the ticket with the call description.
Cancelled/Abandoned call
GET: https://api.movidesk.com/public/v1/asterisk_startCanceledCall?token=155cac97-f203-4bb8-86e1-aa4cb8781f3e&queueId=1&clientNumber=4733990777&id=3&callDate=2018-5-1T17:00:00&canceledDate=2018-5-1T17:20:00
Response: Status 200. This method should be called when the client cancels/abandons the call before it is actually transferred to the agent. In this case, a ticket with the origin of the canceled call will be automatically generated, and an action containing the respective information will be created.
Example of source code in C# for calling the API
Method GET
try
{
var response = await SendAsync("https://api.movidesk.com/public/v1/asterisk_startTransferedCall?
token=YOURTOKEN&queueId=1&clientNumber=4733990777&id=3&branchLine=5252&callDate=2018-5-1T17:00:00&transferDate=2018-5-1T17:02:00",
NULL, "GET", "application/json");
}
catch (WebException ex)
{
var response = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
}
public static async Task<string> SendAsync(string uri, string content, string method, string contentType)
{
var req = WebRequest.Create(uri);
req.ContentType = contentType;
req.Method = method;
using (var stream = await req.GetRequestStreamAsync())
using (var streamWriter = new StreamWriter(stream))
{
await streamWriter.WriteAsync(content);
}
var httpResponse = (HttpWebResponse)await req.GetResponseAsync();
using (var stream = httpResponse.GetResponseStream())
{
if (stream == null)
return null;
using (var streamReader = new StreamReader(stream))
{
return await streamReader.ReadToEndAsync();
}
}
}
The responses are detailed in the variable response and should be handled according to this documentation.