Use this API to integrate the third-party cloud telephony vendors with our CRM. This API will help you to create logs, give real-time popup of incoming calls to the users and get the forwarding numbers based on the department and schedules.


First, you will need to generate an API Key if you have not already done it. To generate the API Key please go to Settings -> Global -> API Key.


We offer four REST APIs to integrate the Telephony system with CRM;


1. Call initiation API

2. Get agent forwarding numbers

3. Ring agent

4. Call end (billing) API


Authenticating the API Request


All the API requests are authenticated with Header's Bearer Token. In PHP CURL it can be set as follows;


$headers = array(
   "Accept: application/json",
   "Authorization: Bearer {token}",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

Here, the {token} should be replaced by your API Key.


Initiate A Call


API URL: https://api.intueri.io/telephony/telephony.php 

Method: GET

Body Format: JSON RAW


{
    "command":"newCall",
    "call_uid":"your_unique_id",
    "ctel_id":"telephony_number",
    "caller":"caller_number",
    "dept_id":0
}


command : "newCall".

call_uid : It should be a unique ID for each new call and should not be repeated.

ctel_id: It is the telephony number you added in the CRM panel from Global -> Custom Telephony

caller: The number of the caller (not more than 15 digits). Please ensure the format is similar to what you have added date in CRM. If you use the format in CRM as country_code . number then this should also be similar.

dept_id: If you want the call to be assigned to a particular department then enter the CRM's department ID.


Get Agent's Forwarding Numbers


Use this API to get the forwarding numbers of the Agent, based on the criteria you set on the CRM.


API URL: https://api.intueri.io/telephony/telephony.php 

Method: GET

Body Format: JSON RAW


{
    "command":"getForwardingNos",
    "call_uid":"call_unique_id",
    "ctel_id":"telephony_number",
    "caller":"callers_number",
    "dept_id":0,
    "forwarding_type":"STRAIGHT",
    "is_sticky_agent":0
}

command : "getForwardingNos".

call_uid : It should be the same ID passed during newCall API request.

ctel_id: It is the telephony number you added in the CRM panel from Global -> Custom Telephony

caller: The number of the caller (not more than 15 digits). Please ensure the format is similar to what you have added date in CRM. If you use the format in CRM as country_code . number then this should also be similar.

dept_id: Add the department ID to get the number of agents only from that department.

forwarding_type: The forwarding type could be STRAIGHT or CYCLIC. If the forwarding type is CYCLIC then all the agents in the department with telephony access will get equal number of calls.

is_sticky_agent: The valid values are 0 or 1. If Sticky agent is set to true (i.e., 1) then the call will only be forwarded to the owner of the lead or otherwise, it will be forwarded to any agent available. The sticky agent setting will not work if the department type is set to "Support" in CRM.


Ring Agent


Use this API to show a Pop-up to the agent on their CRM so they are better equipped for the call.


API URL: https://api.intueri.io/telephony/telephony.php 

Method: GET

Body Format: JSON RAW


{
    "command":"ringAgent",
    "call_uid":"call_unique_id",
    "ctel_id":"telephony_number",
    "caller":"callers_number",
    "fwd_to":"agents_number"
}


command : "ringAgent".

call_uid : It should be the same ID passed during newCall API request.

ctel_id: It is the telephony number you added in the CRM panel from Global -> Custom Telephony

caller: The number of the caller (not more than 15 digits). Please ensure the format is similar to what you have added date in CRM. If you use the format in CRM as country_code . number then this should also be similar.

fwd_to: This should be the number of the agent received from getForwardingNos API. Please ensure the format matches as returned by the API.


Call Ending (Billing) API


Once the call has ended you can send the call details to this API.


API URL: https://api.intueri.io/telephony/telephony.php 

Method: GET

Body Format: JSON RAW


{
    "command":"endCall",
    "call_uid":"call_unique_id",
    "ctel_id":"telephony_number",
    "caller":"callers_number",
    "fwd_to":"agents_number",
    "call_duration":35,
    "call_status":"ANSWERED",
    "call_time_start":"2021-04-14 12:35:25",
    "call_time_end":"2021-04-14 12:36:00"
}


command : "endCall".

call_uid : It should be the same ID passed during newCall API request.

ctel_id: It is the telephony number you added in the CRM panel from Global -> Custom Telephony

caller: The number of the caller (not more than 15 digits). Please ensure the format is similar to what you have added date in CRM. If you use the format in CRM as country_code . number then this should also be similar.

fwd_to: This should be the number of the agent received from getForwardingNos API. Please ensure the format matches as returned by the API.

call_duration: The total duration of the call in seconds.

call_status: Following values are acceptable. 

"ANSWERED","MISSED","CANCELLED","DROPPED","JUNK","WAITING","BUSY","CONGESTION","OTHER","VOICEMAIL","EXPIRED","CALLBACK","SUSPENDED","BLACKLIST","NOANSWER"

call_time_start: Date time value on which the call was started.

call_time_end: Date time value at which the call was ended.