When a manager receives a call, caller information can be retrieved in many ways as previously mentioned in caller ID. This information includes the user ID who is responsible for the caller’s card and works with them i.e. the manager.
After getting the user ID, you will be able to retrieve all the information about this manager, and if they are assigned an extension number, you can forward the call to them.
To implement this feature, you will need to make several requests to our API in order to eventually get the phone number of the employee responsible for the caller’s contact card.
$phone_number = /* Incoming call phone number */; $subdomain = /* Your account — subdomain */; $link='https://'.$subdomain.'.kommo.com/api/v2/search/by_phone?phone='.$phone_number; //API request for a search of contact card $curl=curl_init(); #Save cURL session descriptor #Set necessary options for cURL session curl_setopt($curl,CURLOPT_RETURNTRANSFER,true); curl_setopt($curl,CURLOPT_USERAGENT,'amoCRM-API-client/1.0'); curl_setopt($curl,CURLOPT_URL,$link); curl_setopt($curl,CURLOPT_HEADER,false); curl_setopt($curl,CURLOPT_COOKIEFILE,dirname(__FILE__).'/cookie.txt'); curl_setopt($curl,CURLOPT_COOKIEJAR,dirname(__FILE__).'/cookie.txt'); curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0); curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,0); $out=curl_exec($curl); #Initiate an API request and save a response in a variable $code=curl_getinfo($curl,CURLINFO_HTTP_CODE); curl_close($curl); $Response=json_decode($out,true); /* We receive a responsible user ID, from a response of a user card request */ $responsible_user_id = $Response['_embedded']['items']['responsible_user_id'];