Bitrix24 Community

Support » Forum » CRM » Custom Lead Distribution
Pages: 1
RSS
Custom Lead Distribution, lead distribution from a call center software using php and mysql to execute a live transfer of voice and data
Hi,

I'm building a script to transfer a call from my dialer software to the CRM and to assign it to a user based on a variety of parameters (whether they are licensed in a particular state, are active, haven't hit their quota, are logged in to the custom Bitrix24 personal app, etc) and once the lead has been assigned the call center will call the Bitrix24 telephone number to be connected with the CRM user that the lead was assigned to. We can represent the call coming out of the dialer as the customer's phone number so recognition of the correct customer will be identified by Bitrix24.

The problem:
If a CRM user does not pick up the telephone call I need to re-assign it to a different eligible CRM user (meets certain parameters as defined by our PHP scripts and MySQL DB). In order to edit the existing lead I need to first identify the lead ID from Bitrix24 so that I can get that I can update the lead with said ID to have a different responsible party. Do you have any sample code that I can load on my form that is inputting the data to ask the Bitrix24 API what the lead ID is for a certain lead with a specified telephone number attached to it (the one we POSTed earlier)? What's the sample code to simply update that lead, using the lead ID as the unique identifier, to have a different responsible party?

Thank you for your assistance.

Regards,
Nate
Hello Nathaniel,

The existing integration of Bitrix24 with the SIP-phones including softphones doesn't suit you because of the specific queue you need, right?

Please clarify if you are coding for Bitrix24 Cloud or Self-hosted version?
It suits us but I need to hand off a call from my predictive dialer software to a user within Bitrix. I just found that Bitrix returns the lead id after we post it to the system so I have been able to fix my problem in the original post. Basically we need a better way to distribute leads than what Bitrix is providing, due to the characteristics of our users (specific licensing and others), so I'm building it externally. Our system will decide, based on a database we'll keep on our bitrix users containing state licensing, active/inactive, daily quotas, etc, which 'Responsible Person' to assign it to in bitrix before executing a call to the Bitrix phone number to connect with the 'Responsible Person' for a warm transfer of the voice (after the data).

I'm a novice/intermediate programmer as my primary role is a branch manager of a mortgage company, by the way, so my knowledge is limited on this technology stuff. I couldn't figure out a way to accomplish this with Bitrix internally.

We use the cloud version but are looking into buying the self-hosted version in the future to further customize and perhaps bring the predictive dialing capability into the software to migrate our call center users over as well.
Hi Nathaniel!

We don't have a good REST API for telephony so far. It will be accessible a bit later. In the self-hosted edition you have access to the system source code and you're able to write your own extensions for it. We can recommend a partner to help if needed. Unfortunately, this task cannot be easily solved in the forums.

Best,

Yana.
We will be looking at purchasing the self-hosted version for multiple divisions in the next 6-8 months but are just trying to get the basic project up and running for now.

When I'm posting to update a lead from my external application I'm getting the following error. Do you have more detailed information on it?

<response><error>insufficient_scope</error><error_descriptio­n>The request requires higher privileges than provided by the access token.</error_description></response>

https://soria.bitrix24.com/rest/crm.lead.update.xml?id=172&RESPONSIBLE=1&auth=(i have secret key in here.)

I'm trying to do something like that.. just simply change the responsible party on a lead from my external application using POST.

Can you give me a working example of how this link needs to go out or why I don't have the right priveleges. I've followed the steps in the API documentation.
Hello Nathaniel,

It seems, that the secret key was obtained without permission to the CRM. This could happen if you were getting the key without specifying the CRM permission at the scope parameter or you didn't specify this permission for the app.


I should also note, that apps coded for the cloud version cannot be used for the self-hosted versions (at least it is impossible now). There are different types of API in these versions.
That is extremely helpful actually. I know exactly what you're talking about but didn't know how to input the scope when posting correctly so omitted it and thought I was going to be able to get it to work.  :D What is the proper way to put this in? The documentation doesn't explicitly state the format for the application_permissions. So, scope=whatHere?
Code
https://intranet_name.bitrix24.com/oauth/token/?grant_type=authorization_code&client_id=app_ID&client_secret=app_secret_code&code=first_authentication_code&scope=application_permissions&redirect_uri=application_URL

That's fine with the different API's as this is a short-term solution so we can begin operations on the 22nd. We were using a different solution that had a very robust lead distribution through an inbound number before and are having to create our own for Bitrix24 (which we like better, minus the lead distribution challenges). The other software is Velocify (formerly Leads360).
I finally have authorization working and can update a user using the provided examples from my third party server.. the only thing I'm still stuck on is properly organizing the post url to update a lead's data. Can you please see what I'm doing wrong here? I'm trying to update the lead #172 with a responsible user with ID = 4.
Code
                  case 'crm.lead.update.responsible': // test: update lead
                  
                     $data = call($_SESSION["query_data"]["domain"], "crm.lead.update", array(
                         "auth" => $_SESSION["query_data"]["access_token"],
                        "ID" => 172,
                        "ASSIGNED_BY_ID" => "4"
                      ));
                      
                  break;
Hello Nathaniel,

Please look throught the example at the documentation.

"ASSIGNED_BY_ID" should be inside the fields parameter.
We can now assign leads to a different user using an external business process (for example, if the agent didn't pick up the phone, the call center rep can click a button to find another eligible agent in Bitrix24 and re-assign the lead to them before initiating a call, representing themselves as the customers telephone number, to connect with the new assigned agent.) This is now functional using the following in PHP
Code
               <fo rm action="?test=crm.lead.update.responsible" method="post">
                    <label for="userID">User</label>
                    <select name="userID" required>
                   <option value="1">Admin</option>
                   <option value="2">Ignacio</option>
                 </select>
                 <input type="text" placeholder="enter lead ID" name="leadID" required>
                 <input type="submit" value="submit">
               </form>
            
            <a href="?refresh=1">Refresh Authorization</a><br />
            <a href="?clear=1">Remove Authorization</a><br />
            
            <?
               $test = isset($_REQUEST["test"]) ? $_REQUEST["test"] : "";
               switch($test)
               {                  
                        case 'crm.lead.update.responsible': // test: update lead
                  
                     $data = call($_SESSION["query_data"]["domain"], "crm.lead.update", array(
                         "auth" => $_SESSION["query_data"]["access_token"],
                        "ID" => $_POST['leadID'],
                        "FIELDS" => array(
                          "ASSIGNED_BY_ID" => $_POST['userID']
                        )
                      ));
                      
                  break;
Quote
Yana Prokopets wrote:
Hi Nathaniel!

We don't have a good REST API for telephony so far. It will be accessible a bit later. In the self-hosted edition you have access to the system source code and you're able to write your own extensions for it. We can recommend a partner to help if needed. Unfortunately, this task cannot be easily solved in the forums.

Best,

Yana.
Hi Yana,

I'm looking to integrate predictive dialing with Bitrix24.  Would you be able to recommend a partner for me?  We are in the same spot as Nathaniel where I'm just trying to get it up and running on the cloud version while continuing to use an external dialer but ultimately want to have our call center integrated within Bitrix.  VoxImplant is capable of predictive dialing so I'd first like to explore if that functionality can be added through them.  If it can be done on the cloud version, I'd prefer that as well.  Thank you!
Hi Francine

Unfortunately we don't provide this option, but - we have added REST API for Telpehony for cloud so far, the self-hosted version has API available as well. We have  anew partner in UK who works tight with telephony services, you can contcat him dircetly:

sa@air21group.co.uk    
Air21 Group
Shahid Ahmed

Best,

Yana.
Quote
Yana Prokopets wrote:
Hi Francine

Unfortunately we don't provide this option, but - we have added  REST API for Telpehony  for cloud so far, the self-hosted version has API available as well. We have  anew partner in UK who works tight with telephony services, you can contcat him dircetly:

sa@air21group.co.uk    
Air21 Group
Shahid Ahmed

Best,

Yana.
Thank you for the recommendation Yana.  I'm reaching out to him now.  
Hi iwould like to ask how to do auto dial in bitrix , best regards ryan

pls send me info at rj.jorge@phonetixcorp.com
Hi Ryan,

Progressive dialer option is not released yet. We plan to add it soon.

Best,

Yana.
Ann Slyshkina,Hello!
I'm facing the same problem, could you please explain how you fixed this issue?
Thanks in advance!
Please report errors to our Helpdesk directly. Thank you.

Best,

Yana.
Pages: 1
2,000,000+
organizations
are already using Bitrix24