📜 ⬆️ ⬇️

How to optimize the online store. Part 1. Automatic calling of incoming leads

A week after the previous article , where I talked about building a bot for Telegram, an online store of wristwatches asked me for advice, which by that time had already built some processes for its needs. With the growth of business, they are faced with the problem of processing a large number of incoming requests, and depending on the quick response to an application, it depends on whether a person buys a product or not.

Here I will describe their case for optimizing online store processes using Corezoid.com and give you open access a link to the process template described below.

What needs to be done:
1) Add a lead to CRM (in this case, Bitrix24) with filling in all the necessary additional fields.
2) Notify sellers of the lead or error.
3) Notify the client about the successfully accepted order, as well as tell about the additional action (try to warm up the client, raise the average bill).
')
At the entrance we have:
1) The name and phone number of the client who is interested in our product.
2) Defined by ip city of the client.
3) client timezone.
4) The identifier of the partner (ref-link in cookies), from which the request came.

The solution was a bunch of API of several services through Corezoid.com, namely: Bitrix24 (CRM-system) + VoxImplant (service for callback implementation) + Telegram (messenger).

To send a lead for processing in Corezoid, you need to make an API request from a php script that receives data from a web form on the site. On their example, it looks like this:

$data = (object) array('server'=>$_SERVER,'cookies'=>$_COOKIE,'post'=>$_POST ); $full = (object) array('ops'=> array( (object) array( 'ref'=>$ip,'type'=>'create','obj'=>'task','conv_id'=>'31754','data'=> $data)) ); $cmd = ( json_encode( $full ) ); $str = "curl 'https://www.corezoid.com/api/1/json/public/31754/e4203ff8f55f17595a46549d35dbd00d51d0879d' -H 'Accept: application/json, text/javascript, */*; q=0.01' --data '".$cmd."' --compressed"; $res = shell_exec($str); 

The $ data object is formed from the data that must be passed to Corezoid for processing.

The $ ops object includes the ref (referense) parameter - a unique id under which the application will be fixed in Corezoid. If at the moment there is already an application in the process of working with the same ref, the second one will not be added. In this example, they use the ip-address of the client as a ref.

The parameter conv_id is responsible for the formation of the task in a specific process (ID Process).

The URL to which we will send the data and the conv_id of the process is taken from the property in the admin panel:



Application processing

First of all, the application gets into the starting node. It is different from all green. You can view this application and see the data that arrived at the entrance.



Since the store actively uses the affiliate sales scheme, the first step is to determine from which partner the order came.

Through API Bitrix24 we get the ID and data of this partner.
For authorization in the API, the value of the “auth” parameter is substituted by a construct that allows you to dynamically get the “access_token” value from the process of its generation and update. A detailed description of this process in the documentation on Corezoid.com

In this example, the data on the partner label is stored in the “cookies” object in the “utm_source” parameter, which the company tracks after clicking on the affiliate link. Pass the value of this parameter to the API.



The next step is for the CODE logic, in which the store handles the phone. The processing consists in autostituting the first digit 8 by 7, and if the client has entered only 10 digits and the first one starts at 9, then 7 is added to the beginning in order for the phone to be correctly processed by the dialer script.



The next step is to send the application to a separate RPC “Create new lead [RPC]” process. He creates a lead in CRM and returns the lead ID. The Corezoid documentation has a detailed description of this process .



If the lead is successfully created, the id will be returned to the variable lead_id.
The next step is to copy the application into the process that will dial the client. After copying, it will immediately proceed to the next step, without waiting for the return of any values ​​from the VoxImplant Robot Call process. This is the main difference from an RPC request when data from another process is expected to return.

First of all, the dialer logic adds a variable with the length of the phone through the CODE logic. If the phone is longer than 11 digits, then it is sent to the final node, because the phone is too long.

The next block receives the current time in the MSC in the variable timenow.



This is necessary so that if the lead came at night or early in the morning, the store would not disturb the customer with a night call, but simply send an SMS about the successfully accepted order and a message that they would call back during working hours.

After the CODE logic in the same block, the time of day and the fact of sending SMS to the client is checked. If the message was not sent and the time is not working, the application goes to the block "Send Night SMS". Here the store sends an SMS to the client through the API logic and get the answer in the description variable. Then they go to "sleep" in a timeout of 2 hours.



The application hanging in timeout looks like this:



If the time is working, then you need to call the customer and report on the successfully accepted order, well, tell about the additional action.

This task was implemented through API logic, which runs the script on the VoxImplant service.



VoxImplant makes a call to the client and loses to it the prepared record of a successfully received order. Additionally, the function of determining the answering machine is built into the code.

{script code}

Then the request goes to the Callback logic in Corezoid, which expects a response from VoxImplant with the results of the call. If we did not wait for an answer, something went wrong, and the application “falls” in manual processing. If everything is ok, and VoxImplant sent the results, then we enter the process of distributing the results.

If the number is incorrect, then the application goes to the final node, it makes no sense to call and send SMS to this number. If the client did not pick up the phone or his phone is now turned off, then our application goes to the "Underdial" status and takes a timeout in half an hour.



If the customer has successfully reached the customer, then we will additionally notify via SMS that his order has been successfully accepted, and close the application. When determining the autoresponder by VoxImplant, the store also sends an SMS to the customer, but they do not ring any further, since it is not known when the customer picks up the phone and the store spends money on each call. Additionally, in the logic you can embed a limit on the number of calls, as well as update the lead in CRM with the status of the call.



The process also provides for a notification in the Telegram to the seller, if the main process when receiving the list of partners is an invalid token and you need to process the request manually. And the notification of a successfully added lead. And in the process for dashboards, with the help of the IF logic, the applications are distributed to the nodes according to the criteria that determine the partner or site and the total amount of orders from each partner.

In the following articles, I will describe other cases of using Corezoid in an online store and share templates:

  1. Affiliate program organization (Bitrix24 + Corezoid + Google Sheets);
  2. automation of courier service (MoySklad + Corezoid + Telegram);
  3. Check the status of the invoice (Cdek + Corezoid + Telegram);
  4. Bot - the controller of the execution of business processes (Telegram + Corezoid + Bitrix).

About the most interesting, write in the comments.

The template described in the article is available by reference . And you can implement your own case studies of combining different services into a single ecosystem on Corezoid.com .

Have questions?
You can contact me in the Telegram or by e-mail.

Source: https://habr.com/ru/post/267085/


All Articles