TABLE OF CONTENTS [Document Version - 1.8]
- Contents
- Usage
- Authentication
- Token API
- Common API Parameters
- Responses
- CallActionResponse
- Entities
- Methods
- Log In
- Log Out
- Get Calls
- Go Ready
- Go Not Ready
- Request Break
- Dial
- Dial Ext
- Dial Preview
- Shotgun Dial
- Hangup
- Dispose
- Hold
- Retrieve
- Start Recording
- Stop Recording
- Campaigns
- Users
- Result Codes
- ACD Queues
- Lead Phones
- Change Lead Phone
- Create New Lead
- Connect Calls
- Transfer To User
- Complete Transfer
- Appendix
Usage
This API is designed as an Agent Remote Control. The API commands will control an already existing agent that is currently logged into the system.
Authentication
An authentication token is required to access this API. A token can be requested from the token service using the Token API.
Tokens API
All API methods require a security token to use the system. This token is stored in the HTTP cookie to allow multiple API calls from one authentication request.
A token is requested by authenticating with a user and password combination. The Token service API will return a token on success.
Token URL
https://[CUSTOMER].maxcontact.com/webservices/services/apitoken/login/{login}
Password
The password needs to be sent in the authorization header of the request; the password needs to be converted to Base64 with ASCII encoding to get the bytes[] from the password string.
Steps
- Make a request to the token Uri
- Store token key for any subsequent requests
- Make request to the Callbacks API
Recommendations
- It is recommended that you keep track of the Token Key and its expiry as making a request every time can slow down the import process.
- Login should be plain text.
When a successful API call is made to the API Token service, it will return a json/xml object A token key must be passed to each API endpoint along with the request.
Common API Parameters
The following is a list of common parameters that are used by a significant number of the API methods, along with details of what each parameter represents.
- Call Id – The unique integer id of particular call, these Ids are maintained in- memory within the system, with values starting at 1,000 each time the system starts up.
- Campaign Id – The unique identifier of a particular campaign as recorded in the correspondingly named table in the system’s database.
- CLI (Caller ID) – for inbound calls this is the number that the customer is dialling from (if supplied).
- Lead Id – Unique id of a particular campaign as recorded in the correspondingly named table in the database.
- Lead Phone Id – Unique id for each phone linked to a particular lead, these values can be found in the database.
- List Id – When leads are imported into the system they are grouped together into lists this is the unique id of a particular list as recorded in the database.
- Reference Id – When importing leads into the system it is possible to supply an external reference number (e.g. a customer Id from an external CRM system etc). Reference Id parameters allow the caller to supply one of these external reference numbers in place of other parameters (e.g. lead Id or Phone Number etc.).
- Result Code – When an agent completes a call with a customer they are required to select a result code that outlines the outcome of the call. A list of the result codes included by default with the system is available in the appendix, but it is worth noting that it is possible to configure this list of the result codes to meet the needs of your business.
- User Id – Unique id of a particular user (often representing an agent) as recorded in the corresponding table in the database.
Responses
The API by default will return an XML response, but Accept and Content-Type headers with values of application/json can be supplied in your requests if desired and this will result in the API returning JSON formatted responses.
CallActionResponse
All methods will return a CallActionResponse object. The “data” property will be a different type dependent on the method used.
{
Success: Bool,
Data: This type is dependent on the method used, entities are described below
ResponseCode: int,
ResponseDetail: string
}Notes
See the appendix for a list of the various response codes that the API returns.
Entities
Call
Returned by /dial, and an array of these is returned by /getcalls, this represents an active call.
{
CallId: int,
CallStartTime: dateTime,
CallState: int,
CallStatus: int,
CustomerName: string,
CustomerName2: string,
PhoneNumber: string,
RecordingState: int
CauseValue: int
}Notes
- Consult the appendix for a list of the various call states, call statuses, recording states and cause values that may be returned by the API.
Agent Name ID Pair
An array of these is returned by /users
{
FullName: string,
ID: int
}Lead Phone
This object is returned by /leadphones
{
LeadId: int64,
PhoneNumber: string,
RecordType: string,
RecordTypeId: int
}Notes
- RecordTypeId and RecordType are used to identify what type of phone number or contact information the lead phone relates to (e.g. work, home, mobile etc.). Consult the appendix for a full list of phone/record types.
Campaign
Returned by /campaigns
{
CampaignID: int
CampaignName: string
Type: string
Active: boolean
AlwaysRun: boolean
AutoRecord: boolean
BlackoutDates: string array
MaxLines: int
CallerID: string
...ACD (Skill) Queue
An array of this type is returned by /acdqueues
{
AbandonThreshold: int
AcceptableQueueTime: int
AcdIcon: string
AcdName: string
Active: boolean
DefaultTimeout: int
DefaultTimeoutIvr: int
ID: int
…
}Result Code
An array of this type is returned by /resultcodes. A list of the default result codes is available in the appendix.
{
Code: string
Description: string
IsAgentViewable: boolean
IsCallAgain: boolean
IsCallback: boolean
IsSuccess: boolean
…
}Methods
It is worth noting that a number of the following API methods send instructions to the live CCaaS system (e.g. GoReady, Dial etc.). A successful response from these API methods simply indicates that the instruction has been relayed to the system but, this does not indicate that the requested action was necessarily successful. For instance, if an instruction is sent for a certain user to GoReady when that user is not logged into the system or they are already talking to a customer then the instruction from the API will be ignored by the system.
Log In
API call to log the agent into the system
POST
/webservices/services/telephony/login
Body:
{
UserId: int
CampaignId: int
Extension: string
}
Returns:
CallActionResponse containing integer result codeLog Out
API call to log the agent out of the system
POST
/webservices/services/telephony/logout
Body:
{
UserId: int
CampaignId: int
}
Returns:
CallActionResponse containing integer result codeGet Calls
Returns the current active calls for the specified user.
GET
/webservices/services/telephony/getcalls/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of CallsGo Ready
Puts the specified user into the ready status for the campaign they are logged into
GET
/webservices/services/telephony/goready/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing integer result codeGo Not Ready
Puts the specified user into the not ready status for the campaign they are logged into.
PATCH
/webservices/services/telephony/gonotready/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing integer result codeRequest Break
Requests to put the specified user into break status with the type of break specified by the Break Id.
PATCH
/webservices/services/telephony/gotobreak/user/{userId}
Params:
userId: int
Body:
{
BreakId: int
}
Returns:
CallActionResponse containing integer result codeNotes
- The appendix contains a list of the default break types and the associated Id values however, it is possible to configure the list of break types in order to meet the needs of your business.
Dial
Initiates a manual dial for the specified user to the given phone number. A lead Id and campaign Id can optionally be specified however, by default, the number will be matched to the newest lead. If there is no match, a new lead will be created.
GET
/webservices/services/telephony/dial/user/{userId}/phone/{PhoneNum}?leadid
={leadId}&campaignId={campaignId}
Params:
userId: int
phoneNum: string
leadId: long
campaignId: int
Returns:
CallActionResponse containing Call dataDial Ext
Initiates a manual dial for the specified user to the given phone number. The user Id and phone number are mandatory parameters but all of the other parameters are optional.
When performing a manual dial we will attempt to match to a lead by using a phone number, reference Id and list Id if provided. This can be used when the same phone number has multiple leads. If a campaign Id is supplied then the call will be linked to the supplied campaign rather than the campaign that the agent is currently on.
POST
/webservices/services/telephony/dialext
Body:
{
UserId: int
PhoneNum: string
CampaignId: int
CLI: string
LeadId: long
ListId: int
ReferenceId: string
UniqueRef: string
AdvancedLeadLookUp: Boolean
}
Returns:
CallActionResponse containing Call dataDial Preview
When the user is assigned a Preview Dial this endpoint can be used to trigger the dialling of the preview call. The call Id parameter value should be the integer Id of the call that the agent is currently previewing.
PATCH
/webservices/services/telephony/placepreviewdial/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing integer result codeShotgun Dial
Initiates dials for the specified user to the given phone numbers simultaneously. A Lead Id,ReferenceId, List Id and Caller Id (CLI) or Unique Reference can optionally be specified.
POST
/webservices/services/telephony/shotgun-dial
Body:
{
UserId: int
PhoneNumbers: string[] – max 5 numbers
LeadId: long
ReferenceId: string
ListId: int
CampaignId: int
CLI: string
UniqueRef: string
}
Returns:
CallActionResponse containing an array of CallIdsLead Lookup Logic
- If Lead Id is provided, lead will be searched by Lead Id
- If List Id is also provided, lead will be searched by Lead Id and List Id
- If lead was not found by Lead Id and Reference Id was provided, lead will be searched by Reference Id
- If List Id is also provided, lead will be searched by Reference Id and List Id
- If lead was not found, it will be searched for by phone number ordered by importedDate
- If lead was not found, it will be created. For that step, a List Id is required
Hangup
Hangs up the specified call and places the agent in the wrapping status
GET
/webservices/services/telephony/hangup/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing integer result codeDispose
This method will disposition the specified call with a chosen result code. The call will also be hung up if it has not already.
GET
/webservices/services/telephony/dispose/user/{userId}/call/{callId}?resultCod
e={resultCode}
Params:
userId: int
callId: int
resultCode: string
Returns:
CallActionResponse containing integer result codeNotes
A list of the default result codes is available in the appendix.
Hold
Places the specified call on hold.
GET
/webservices/services/telephony/hold/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing integer result codeRetrieve
Retrieves the specified call on hold.
GET
/webservices/services/telephony/retrieve/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing integer result codeStart Recording
This method will start or continue the recording for the specified call.
GET
/webservices/services/telephony/startrecord/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing an array of CallsStop Recording
This method will stop the recording of the specified call. This is useful for preventing any sensitive information such as bank details being recorded.
GET
/webservices/services/telephony/stoprecord/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing an array of CallsCampaigns
Gets an object containing all the campaigns in the system
GET
/webservices/services/telephony/campaigns/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of CampaignsUsers
Gets an object containing the names and ids of all users.
GET
/webservices/services/telephony/users/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of agent names and idsNotes
- The userId parameter is not mandatory and it is possible to call this method and passing a value of zero for this parameter.
Result Codes
Gets an array of all the available result codes.
GET
/webservices/services/telephony/resultcodes/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of result codesNotes
- The userId parameter is not mandatory and it is possible to call this method and passing a value of zero for this parameter.
- A list of the default result codes is available in the appendix.
ACD Queues
Returns a list of ACD queues in the system. These are also known as skill queues.
GET
/webservices/services/telephony/acdqueues/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of ACD queuesNotes
- The userId parameter is not mandatory and it is possible to call this method and passing a value of zero for this parameter.
Lead Phones
Returns the lead phones associated to the supplied lead Id.
GET
/webservices/services/telephony/leadphones/user/{userId}/lead/{leadId}
Params:
userId: int
leadId: long
Returns:
CallActionResponse containing an array lead phonesNotes
- The userId parameter is not mandatory and it is possible to call this method and passing a value of zero for this parameter.
Change Lead Phone
This method will change the lead of a call that is in progress. A lead phone Id is supplied, and the call will be associated to the lead phone’s corresponding lead.
GET
/webservices/services/telephony/changelead/user/{userId}/call/{callId}/leadp
hone/{leadPhoneId}
Params:
userId: int
callId: int
leadPhoneId: int64
Returns:
CallActionResponse containing integer result codeNotes
- The userId parameter is not mandatory and it is possible to call this method and passing a value of zero for this parameter.
Create New Lead
This method will create a new lead with the phone number specified, then assign the new lead to the call specified.
GET
/webservices/services/telephony/createnewlead/user/{userId}/call/{callId}/ph
one/{phoneNum}
Params:
userId: int
callId: int
phoneNum: string
Returns:
CallActionResponse containing integer result codeNotes
- The userId parameter is not mandatory and it is possible to call this method and passing a value of zero for this parameter.
Connect Calls
This method allows two calls that are currently in progress to be bridged together. This is useful to perform a warm transfer to a 3rd party or external DDI. You can also specify a success count and any notes relating to the call. The result codes and call id’s are required, however the notes and number of successes are optional parameters. A list of the default result codes is available in the appendix.
GET
/webservices/services/telephony/connectcalls/user/{userId}?call1={call1Id}&cal
l2={call2Id}&resultcode1={resultCode1}&resultcode2={resultCode2}¬es1={no
tes1}¬es2={notes2}&numsales1={numSales1}&numsales2={numSales2}
Params Required:
userId: int
call1Id: int
call2Id: int
resultCode1: string
resultCode2: string
Params Optional:
notes1: string
notes2: string
numSales1: int
numSales2: intTransfer To User
Begin the transfer of an existing call from one agent to another.
POST
/webservices/services/telephony/transfertouser
Body:
{
SendingUserId: int
ReceivingUserId: int
CallId: int
IsAttended: boolean
ResultCode: string
}
Returns:
CallActionResponse containing integer result codeNotes
- A list of the default result codes is available in the appendix.
Complete Transfer
Complete the transfer of an existing call from one agent to another.
POST
/webservices/services/telephony/transfertouser
Body:
{
SendingUserId: int
ReceivingUserId: int
CallId: int
IsAttended: boolean
ResultCode: string
}
Returns:
CallActionResponse containing integer result codeNotes
- A list of the default result codes is available in the appendix.
Appendix
Appendix 1: Response Codes
The following table contains a list of the response codes that are returned by the API methods:
ID | Description |
| -3 | Error |
| -2 | Command Timeout |
| -1 | Connection Failed |
| 0 | Success |
| 1 | General Failure |
| 2 | Invalid Parameters |
| 3 | Call No Longer Exists |
Appendix 2: Record/Phone Types
The following table contains a list of the available phone types as recorded against each record in the lead phone table. This value is used to identify what type of contact details the lead phone record relates to.
ID | Description |
| 0 | Home |
| 1 | Work |
| 2 | Mobile |
| 3 | Home Email |
| 4 | Work Email |
| 5 | Messenger |
Appendix 3: Recording States
The following table contains a list of the recording states that the system supports:
ID | Description |
| 0 | NotRecording, |
| 1 | PendingStart, |
| 2 | CancelPendingStart, |
| 3 | Recording, |
| 4 | PendingStop |
Appendix 4: Break Codes
The following table contains details of the default break types that come with the system as standard. It is worth noting that this list can be amended within the Manager Portal application.
ID | Name | Description |
| 1 | Break | Standard 10 minute break. |
| 2 | Lunch | 30 minute break for meals. |
| 3 | Meeting | Break for a meeting. |
| 4 | Bio | Break to take care of biological needs. |
| 5 | Other | A break that does not fit other categories. |
Appendix 5: Result Codes
Result codes are used to record the outcome of an interaction between an agent and an end customer (e.g. ‘Sale’, ‘Callback’, ‘No Answer’ etc.). The following table contains a list of the result codes that are set up in the system when it is shipped. It is worth noting that it is possible to edit this list within the Manager Portal application in order to meet the
requirements of your business.
Result Code | Description |
| ABANDON | Abandoned Queue |
| ANSMACH | Answer Machine |
| BAD | Bad Phone Number |
| BLACKLIST | Inbound call was blocked |
| BRIDGE | Bridge Call (Internal) |
| BRIDGE_WARM | Bridge Call (Warm Transfer) (Internal) |
| BUSY | Busy |
| CALLBACK | Private Callback |
| CANCEL | Cancel - Third Party |
| DEADAIR | Dead Air |
| DNC | Do Not Call |
| HKT | Hot Key Transfer |
| HKT_BRIDGE | Hot Key Transfer (Internal) |
| HKT_CANCEL | HKT Cancel - Third Party |
| HKT_WARM | Hot Key Transfer (Warm Transfer) (Internal) |
| IABANDONED | Interaction abandoned |
| IBRANCHED | Interaction branched |
| ICUSTOMERTIMEOUT | Interaction customer timeout |
| IDUPLICATETERMINATE | Duplicate Terminate Interaction |
| INBOUND | Inbound |
| IRATE | Irate |
| IRECEIVED | Interaction received |
| ISENT | Interaction sent |
| ITERMINATED | Interaction terminated |
| ITIMEOUT | Interaction timed out |
| ITXMOVED | Interaction Session Was Moved |
| ITXUSERDISCONNECT | A User Disconnected before handling the interaction |
| KICKBARGE | Kicked and Retransferred |
| LIVEANS | Live Answer (Person) |
| MAXTO | Maximum Timeout Reached |
| NI | Not Interested |
| NOANSWER | No Answer |
| NOCARRIER | No Carrier |
| NOCPA | No CPA (System) |
| OB-ABAN | Outbound Abandon |
| OPERATOR | Operator/Could Not Reach |
| REDIAL | Redial |
| SKIPPED | Skipped Record |
| SYSANSMACH | Answering Machine (System) |
| SYSBUSY | Busy (System) |
| SYSDROP | Dropped Call (System) |
| SYSFAX | Fax/Modem (System) |
| SYSNOANS | No Answer (System) |
| SYSOI | Operator Intercept (System) |
| UNCONTACT | Uncontacted |
| USER | Agent Nail-Up |
| WRAP_TO | Timed-Out Wrapping |
| WRONG | Wrong Number |
| XFER | Transferred |
| YANK | Yanked |
Appendix 6: Call Statuses
During their lifetime calls can typically through a number of statuses, the following table provides a list of the these call statuses.
ID | Name |
| 0 | Uncontacted |
| 1 | NoCarrier |
| 2 | Person |
| 3 | NoAnswer |
| 4 | Busy |
| 5 | Operator |
| 6 | Dropped |
| 7 | AnswerMachine |
| 8 | Transferring |
| 9 | FaxModem |
| 10 | DisconnectNoCpa |
| 11 | DisconnectTimeout |
| 12 | BadRecord |
| 13 | Skipped |
| 14 | DoNotCall |
| 15 | Yanked |
| 16 | Callback |
| 17 | Ringing |
| 18 | WrongNumber |
| 19 | NotInterested |
| 20 | Inbound |
| 21 | Abandoned |
| 22 | User |
| 23 | Irate |
| 24 | OutboundAbanoned |
| 25 | InteractionSent |
| 26 | InteractionTerminated |
| 27 | InteractionAbandoned |
| 28 | InteractionTimeout |
| 29 | InteractionReceived |
| 30 | InteractionBranched |
| 31 | InteractionTerminateDuplicate |
| 32 | InteractionMoved |
| 33 | ItxUserDisconnect |
| 34 | InteractionCustomerTimeout |
Appendix 7: Call States
During their lifetime calls can typically through a number of state, the following table provides a list of these call states.
ID | Name |
| 0 | Unknown |
| 1 | InBuffer |
| 2 | PreviewQueue |
| 3 | Previewing |
| 4 | WaitingForLine |
| 5 | Placing |
| 6 | Ringing |
| 7 | CpaAnalysis |
| 8 | InDropQueue |
| 9 | Transferring |
| 10 | InIvr |
| 11 | InExtension |
| 12 | InQueue |
| 13 | InConference |
| 14 | Bridged |
| 15 | OnHold |
| 16 | PreviewOnHold |
| 17 | WithAgent |
| 18 | Wrapping |
| 19 | Terminated |
| 20 | History |
| 21 | InVirtualQueue |
Appendix 8: Cause Values
The following table contains a list of the various cause values supported by the system
ID | Name |
| -1 | Unknown |
| 0 | Normal |
| 1 | Busy |
| 2 | NoAnswer |
| 3 | Unobtainable |
| 4 | NumberChanged |
| 5 | OutOfOrder |
| 6 | IncomingBarred |
| 7 | Rejected |
| 8 | Failed |
| 9 | ChannelBusy |
| 10 | NoChannels |
| 11 | Congestion |
| 12 | TcpConnectFailed |
| 13 | SslError |
| 14 | SslPeerCertNotTrusted |
| 15 | SslPeerCertInvalid |