Let's consider 3 main cases: creating a task in dialer at an event in B24, creating a lead in B24 at an event in Oki-Toki, changing the status of a lead after an event in Oki-Toki. Important! Settings use webhooks in Oki-Toki, as well as Robots and Triggers in B24, which is not available in all tariffs.
Case number 1. How to create a task in dialer on events in B24
Decide from which funnel and from which status you are picking up tasks, then:
- Open the Robots settings in B24 and select the desired status,
- Go to the Robot settings – by clicking "Add"
- Select "Custom Robots" from the dropdown list. Select the Webhook option .
- Everything. (*Unfortunately, there is no official documentation for this.)
In the webhook settings, specify the conditions under which it will send data to Oki-Toki. By default, sending occurs at the moment of transition or creation of a lead/deal to this status. With the help of additional conditions, you can transfer only certain leads from B24 (for example, only those where there is a specific responsible person). Then make an API request to add a task to dialer. Examples of requests are in the Oki-Toki API documentation . The simplest API request should contain the Oki Toki user's API key and phone number. Of course, you can, if necessary, transfer other additional data with a number. For example: order number, customer name, debt amount, etc. api_token – created in the Oki-Toki user profile settings .
dialer_id – dialer number to which the task should be added. Get the value here:
The phone number is transmitted from B24. It can be obtained from different fields of the lead, and therefore you need to specify the variable name B24 with the phone number. Making it easier than you think. More on that below and step by step:
- Take the request prepared earlier (as from the example above, only with the specified api-token and dialer number)
- Open the B24 webhook settings and copy it into the “Handler” field. Place the cursor where you need to substitute the variable (in our case, after the “=” sign next to the phones variable) click on the three dots (…).
- In the menu (…) select the field with the phone and B24 will substitute the variable of this field .
- Save your settings!
- That's it, your API request has been composed and is ready to be sent.
How to check that everything is working? Create or move a lead/deal, and if the request is made correctly, a task will be created in the dialer.
Case number 2. How to create a lead in B24 during events in Oki-Toki
What are the types of events in Oki-Toki and what are they responsible for?
- Call function(s) – events that occur during calls (say message, queue, operator, forwarding, conference, etc.),
- User status – events that occur when the user status changes (busy, ready, away)
- Incoming SMS – incoming SMS event when GSM gateways are used in Oki Toki (only available for UA companies))
- Task status (dialer) – result of task processing in dialer (success, failure, cancellation)
- List modification – events triggered by actions with lists (for example: adding, deleting)
- Disciplinary report – events arising from disciplinary violations of the operator / supervisor (the operator did not answer the call, the operator ended the call)
- AmoCRM – used to handle events from AmoCRM.
How to create a webhook for an event in Oki-Toki
First, create an external integration: 1. Go to Integrations – External Resources – select Webhook . 2. Specify the name of the integration, and in the URL line, insert a link to your B24 and the “Create Lead” method. Example: https://subdomain/crm/configs/import/lead.php , (where subdomain is the address of your account in B24). You can find examples with methods in API – documentation B24 . The configured external integration webhook looks like this:
Next, in the “Integration – Events and Integrations” section, create a webhook for the event:
- Create a new event binding to the integration (webhook) and give it a name;
- Select the type of event (the available conditions of the event will depend on this);
- Specify the integration with Webhook that you did earlier;
- Event action – leave the default value, or specify what needs to be done.
An example of filled event parameters. Depending on the event type, different trigger conditions will be available. You can specify several selection conditions when you need it. Mechanics of adding a condition : select a condition from the list and specify its parameters (select from the available list or fill in manually).
You can specify AND\\OR condition branches :
To create a lead, you need to send a POST request to B24 with the “Create Lead” method in B24. Part of the request (with the subdomain and method) is already contained in the external integration that was specified in the settings, and the rest must be specified in the request parameters (where and what to send). The API is already used here – B24 documentation , it indicates how to correctly formulate a request to CRM, field IDs and method descriptions, etc.
Test request example
The test request will contain only what is necessary: authorization in CRM and a phone number, which will be transferred to the corresponding field “Work phone” in B24.
- First, in the request parameters, specify the authorization fields LOGIN and PASSWORD – these are the credentials of the B24 user with the rights to create leads.
- Next, specify the B24 field IDs and data from Oki-Toki ( example ).
- Query parameters are added by the “Add” button , in the Parameter name write the field ID from B24 (you can find the list of field IDs in the API documentation B24 ), and in the “Parameter value” specify the variable with data from Oki-Toki (which we pass). A list of Oki Toki variables can be found here .
Example: parameter PHONE_WORK (work phone from B24) is passed the Oki Toki variable {{dnis}} (Party B, called subscriber). In the request, you can transfer data from Oki-Toki to the corresponding fields of B24, it is enough to know the IDs of these fields in B24 and the Oki-Toki variables.
Case number 3. How to change the status of a deal during an event in Oki-Toki
This is the simplest case – you need to generate a trigger in B24, copy it to an external integration and then connect this external integration to an event handler (and how to do this – see above) Setting up step by step for the status you need:
- In the settings of Robots in B24 in the “ Triggers ” section, generate a link (link example ).
- Be sure to save your settings!
- In Oki-Toki, in the Integrations – External Resources section, create a new external integration with webhook , give it a suitable name, and paste the generated trigger link from B24 into the “URL” field.
- Be sure to save your settings!
- Create a new event in Oki-Toki, specify the parameters and conditions of the event, be sure to select the created external integration with a trigger from B24.
- You do not need to specify anything in the parameters of this event (unlike the webhook for creating a lead).
IMPORTANT! This will not work for outgoing/incoming calls, since the system does not get the lead ID from the external CRM with the number. The webhook to change the status in B24 works ONLY if the tasks were transferred from B24 to dialer with the lead ID.
Additionally: How to open profiles from CRM B24?
When making automatic calls from dialer, there is a useful opportunity – to open a profile/lead card in external CRM (when autocalling, you can open a lead card from B24). The necessary conditions
- The operator uses the Oki-Toki operating place (with auto-opening of the questionnaire turned on)
- The task must be added to dialer from B24 with the required lead\\deal ID. Passing additional data to the lead is sent when requested in the details parameter (example: details={ID:{{ID}}})
- In the dialer where you want to open an external profile, specify a link to an external CRM.
- Link example: https://subdomain.bitrix24.ua/crm/lead/details/{{ID}}/ take the link to the card here , specify only the {{ID}} variable at the end of the link instead of the profile number.
- Paste the link in the main dialer settings here:
- Don't forget to save your dialer settings after specifying an external link.
Any questions? Create a ticket in your personal account, and Technical support will help with the answers.