Intro
| Name | Description |
|---|---|
| Deal | A sales card that goes through the stages of the sales funnel. |
| Contact | Customer card from your CRM system. |
| Sales funnel | It consists of the stages that a transaction goes through from creation to successful completion (for example, payment). |
| Stage | The part of the sales funnel that a deal takes through a company's sales process. |
| Responsible employee | An employee in CRM responsible for a specific transaction. |
To set up integration via API you need:
- Create a CRM structure in CallGear
- Pass the structure of each sales funnel
- Submit a list of employees and persons responsible for each transaction
- Send contact list
- Load transaction history
- Configure end-to-end analytics
- Set up the necessary data for analysis in analytic reports
Using a test client as an example, let's look at how to transfer transactions and other necessary data from your CRM.
| Example | Transfer of transactions and other data from CRM |
|---|---|
| Description | Name of the funnel: "Main funnel".
Sales funnel structure:
2 responsible employees 3 contacts
3 trades:
Each transaction has a contact and a responsible employee.
|
1. Transferring the structure of your CRM to CallGear
1.1 Creating a sales funnel structure:
| Method | create.sales_funnel |
|---|---|
| Description | Creating a sales funnel and its stages |
| Available to | Agent, Client |
| В запросе "Порядковый номер этапа" указан как 10, 20, 30, 40. |
Это сделано, для того чтобы в будущем вы смогли добавить промежуточные этапы без редактирования всей воронки. Допустим, в CRM поменялась структура воронки, и добавился этап "Подписание документов" между этапами "Подготовка Документов" и "Счет на предоплату". Вы легко можете добавить этап "Подписание документов" с порядковым номером от 21 до 29. Но лучше 25.
Максимальный номер этапа = 10000
JSON request structure```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "create.sales_funnel",
"params": {
"access_token": "${#Project#auth_prod_4735}",
"ext_id": "1",
"name": "Основная воронка",
"stages": {
"success": {
"ext_id": "1000",
"name": "Успешно реализовано"
},
"failed": {
"ext_id": "10001",
"name": "Сделка провалена"
},
"in_process": [
{
"ext_id": "1",
"name": "Новая сделка",
"order": 10
},
{
"ext_id": "2",
"name": "Подготовка Документов",
"order": 20
},
{
"ext_id": "3",
"name": "Счет на предоплату",
"order": 30
},
{
"ext_id": "4",
"name": "Финальный счет",
"order": 40
}
]
}
}
}
The response will return the ID of the created funnel.
JSON response structure```json { "result": { "metadata": {"limits": { "minute_reset": 23, "minute_remaining": 199, "minute_limit": 200, "day_reset": 35483, "day_remaining": 3319, "day_limit": 3500 }}, "data": { "ext_id": "1" } }, "id": 1, "jsonrpc": "2.0" }
<b> Checking the funnel structure: </b>
| Method | <a href="../get_sales_funnel" style="color:white">get.sales_funnel</a> |
| :----------- | :------------------------------ |
| Description | Getting a list of sales funnels |
| Available to | Agent, Client |
JSON request structure```json
{
"jsonrpc":"2.0",
"id":"number",
"method":"get.sales_funnel",
"params":{
"access_token":"${#Project#auth_prod_4735}",
"filter":{
"field":"ext_id",
"operator":"=",
"value":"1"
}
}
}
JSON response structure```json { "result": { "metadata": { "limits": { "minute_reset": 39, "minute_remaining": 199, "minute_limit": 200, "day_reset": 35139, "day_remaining": 3305, "day_limit": 3500 }, "total_items": 1 }, "data": [ { "ext_id": "1", "name": "Основная воронка", "stages": [ { "stage_name": "Новая сделка", "stage_ext_id": "1", "stage_status": "in_process", "stage_order": 10 }, { "stage_name": "Подготовка Документов", "stage_ext_id": "2", "stage_status": "in_process", "stage_order": 20 }, { "stage_name": "Счет на предоплату", "stage_ext_id": "3", "stage_status": "in_process", "stage_order": 30 }, { "stage_name": "Финальный счет", "stage_ext_id": "4", "stage_status": "in_process", "stage_order": 40 }, { "stage_name": "Успешно реализовано", "stage_ext_id": "1000", "stage_status": "success", "stage_order": 10010 }, { "stage_name": "Сделка провалена", "stage_ext_id": "10001", "stage_status": "failed", "stage_order": 10020 } ] }] }, "id": "number", "jsonrpc": "2.0" }
If necessary, you can rename the sales funnel using the method
<a href="../update_sales_funnel">update.sales_funnel </a> and edit the stages,
using the <a href="../update_sales_funnel_stages">update.sales_funnel_stages method. </a>
#### <b> 1.2 Creating a list of employees responsible for transactions </b>```sh
Если вы не хотите анализировать РК в разрезе по сотрудникам,
то можно пропустить этот пункт
Example:
Adding two employees
| Method | create.deal_employees |
|---|---|
| Description | Creating/adding a responsible employee |
| Available to | Agent, Client |
JSON request structure
Request 1```json
{
"jsonrpc": "2.0",
"id": "1",
"method": "create.deal_employees",
"params": {
"access_token":"${#Project#auth_prod_4735}",
"ext_id": "EID_0007",
"name": "Иванов"
}
}
Request 2```json
{
"jsonrpc": "2.0",
"id": "2",
"method": "create.deal_employees",
"params": {
"access_token":"${#Project#auth_prod_4735}",
"ext_id": "EBdfID_0008",
"name": "Сидоров"
}
}
1.3 Creating contacts
| Method | create.deal_contacts |
|---|---|
| Description | Create a contact |
| Available to | Agent, Client |
Example:
ID |
Имя |
телефон |
email |
|---|---|---|---|
| CID_0001 | Tin Oleg | 79000000000, 79000000001 | test@example.com, test2@example.com |
| CID_0002 | Petrovich | 79000000003 | test3@example.com |
| CID_0003 | New client | 79000000004 |
JSON request structure```json { "jsonrpc": "2.0", "id": 1, "method": "create.deal_contacts", "params": { "access_token": "${#Project#auth_prod_4735}", "contacts": [ { "ext_id": "CID_0001", "name": "Оловянный Олег", "created_date_time": "2019-08-02 21:00:01", "phone_numbers": [ "79000000000", "79000000001" ], "emails": [ "test@example.com", "test2@example.com" ] }, { "ext_id": "CID_0002", "name": "Петрович", "created_date_time": "2019-08-03 12:15:00", "phone_numbers": [ "79000000003" ], "emails": [ "test3@example.com" ] }, { "ext_id": "CID_0003", "name": "Новый клиент", "created_date_time": "2019-08-10 10:40:50", "phone_numbers": [ "79000000004" ] } ] } }
###<b>2. Loading transaction history</b>
To build correct analytics, it is necessary to transmit all the stages that the transaction has gone through, and not just its current stage (at the time of upload).
<div>This can be done in two ways:</div>
<ol>
<li> Transmit an update on a deal to CRM using a trigger, i.e. upload it to CallGear when one of the events occurs:
<ul>
<li>Creating a deal</li>
<li>Transfer to another stage</li>
<li>Updating one of the parameters: contact, owner, transaction amount</li>
</ul></li>
<li>
<div>
Once per period (hour, day, week) download the entire history for all transactions at once.
For each transaction, transfer all completed stages and the time of transition to each stage.
</div>
<div> <br>All transferred transactions are displayed in the "End-to-End Analytics" report cumulatively (that is, all stages that the transaction has passed through are displayed, not just the current one). </div>
<div> <br>If any of the intermediate stages has not been transferred, the system will automatically create it with the flag is_generated = True,
this is necessary for correct display in analytical reports. Stage indicators take into account transactions that have passed through this stage. </div>
</li>
</ol>```sh
Отдельного метода по созданию и обновлению сделки у нас нет.
Сделка создается при передачи первой записи по ней, и обновляется
с каждым новым вызовом метода.
```json { "jsonrpc": "2.0", "id": 1, "method": "upload.deals_history", "params": { "access_token": "${#Project#auth}", "deals": [ { "ext_id": "DID_0001", "name": "Продажа аннигиляторной пушки", "created_date_time": "2019-08-15 07:07:00", "modified_date_time": "2019-08-15 07:07:00", "modified_stage_date_time": "2019-08-15 07:07:00", "contact_ext_ids": [ "CID_0001" ], "main_contact_ext_id": "CID_0001", "employee_ext_id": "EID_0001", "sales_funnel_ext_id": "SFID_0001", "stage_ext_id": "1", "comments": "Супер сделка" }, { "ext_id": "DID_0001", "name": "Продажа аннигиляторной пушки", "created_date_time": "2019-08-15 07:07:00", "modified_date_time": "2019-08-16 07:07:00", "modified_stage_date_time": "2019-08-16 07:07:00", "contact_ext_ids": [ "CID_0001" ], "main_contact_ext_id": "CID_0001", "employee_ext_id": "EID_0002", "sales_funnel_ext_id": "SFID_0001", "revenue": 5000, "stage_ext_id": "2", "comments": "Супер сделка" }, { "ext_id": "DID_0001", "name": "Продажа аннигиляторной пушки", "created_date_time": "2019-08-15 07:07:00", "modified_date_time": "2019-08-17 07:07:00", "modified_stage_date_time": "2019-08-17 07:07:00", "contact_ext_ids": [ "CID_0001" ], "main_contact_ext_id": "CID_0001", "sales_funnel_ext_id": "SFID_0001", "stage_ext_id": "3", "comments": "Супер сделка" }, { "ext_id": "DID_0001", "name": "Продажа аннигиляторной пушки", "created_date_time": "2019-08-15 07:07:00", "modified_date_time": "2019-08-18 07:07:00", "modified_stage_date_time": "2019-08-18 07:07:00", "contact_ext_ids": [ "CID_0001" ], "main_contact_ext_id": "CID_0001", "sales_funnel_ext_id": "SFID_0001", "stage_ext_id": "4", "comments": "Супер сделка" }, { "ext_id": "DID_0001", "name": "Продажа аннигиляторной пушки", "created_date_time": "2019-08-15 07:07:00", "closed_date_time": "2019-08-19 10:07:00", "modified_date_time": "2019-08-19 10:07:00", "modified_stage_date_time": "2019-08-19 10:07:00", "contact_ext_ids": [ "CID_0001" ], "main_contact_ext_id": "CID_0001", "sales_funnel_ext_id": "SFID_0001", "stage_ext_id": "10000", "comments": "Супер сделка" } ] } }
Creating a deal that failed from the first stage:
JSON request structure```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "upload.deals_history",
"params": {
"access_token": "${#Project#auth}",
"deals": [
{
"ext_id": "DID_0002",
"name": "Беговел Puky Pukylino",
"created_date_time": "2019-08-15 07:07:00",
"modified_date_time": "2019-08-15 07:07:00",
"modified_stage_date_time": "2019-08-15 07:07:00",
"contact_ext_ids": [
"CID_0002"
],
"main_contact_ext_id": "CID_0002",
"employee_ext_id": "EID_0002",
"revenue": 4250,
"sales_funnel_ext_id": "SFID_0002",
"stage_ext_id": "1",
"comments": "Супер сделка"
},
{
"ext_id": "DID_0002",
"name": "Беговел Puky Pukylino",
"created_date_time": "2019-08-15 07:07:00",
"closed_date_time": "2019-08-19 10:07:00",
"modified_date_time": "2019-08-19 10:07:00",
"modified_stage_date_time": "2019-08-19 10:07:00",
"contact_ext_ids": [
"CID_0002"
],
"main_contact_ext_id": "CID_0002",
"sales_funnel_ext_id": "SFID_0002",
"stage_ext_id": "10002",
"comments": "Не выдерживает необходимый вес"
}
]
}
}
Creating a transaction that has reached the "Invoice for prepayment" stage:
JSON request structurejson
{
"jsonrpc": "2.0",
"id": 1,
"method": "upload.deals_history",
"params": {
"access_token": "${#Project#auth}",
"deals": [
{
"ext_id": "DID_0003",
"name": "Sony PlayStation 4 Slim 500 ГБ",
"created_date_time": "2019-08-15 07:07:00",
"modified_date_time": "2019-08-15 07:07:00",
"modified_stage_date_time": "2019-08-15 07:07:00",
"contact_ext_ids": [
"CID_0003"
],
"main_contact_ext_id": "CID_0003",
"employee_ext_id": "EID_0003",
"sales_funnel_ext_id": "SFID_0003",
"stage_ext_id": "1"
},
{
"ext_id": "DID_0003",
"name": "Sony PlayStation 4 Slim 500 ГБ",
"created_date_time": "2019-08-15 07:07:00",
"modified_date_time": "2019-08-16 07:07:00",
"modified_stage_date_time": "2019-08-16 07:07:00",
"contact_ext_ids": [
"CID_0003"
],
"main_contact_ext_id": "CID_0003",
"employee_ext_id": "EID_0002",
"sales_funnel_ext_id": "SFID_0003",
"revenue": 17350,
"stage_ext_id": "2"
},
{
"ext_id": "DID_0003",
"name": "Sony PlayStation 4 Slim 500 ГБ",
"created_date_time": "2019-08-15 07:07:00",
"modified_date_time": "2019-08-17 07:07:00",
"modified_stage_date_time": "2019-08-17 07:07:00",
"contact_ext_ids": [
"CID_0003"
],
"main_contact_ext_id": "CID_0003",
"sales_funnel_ext_id": "SFID_0003",
"stage_ext_id": "3",
"comments": "В ожидании оплаты"
}
]
}
}