Setting Up Automatic Lead Distribution in Bitrix24
Manual lead assignment is a bottleneck in most sales departments. The supervisor spends time on assignments; new leads sit unattended while they are busy. Automatic distribution removes the human from this chain: a lead appears → it is assigned to the right manager → the manager receives a notification.
Built-in Distribution Tools
Distribution queue — the simplest option. Bitrix24 assigns leads to managers in a round-robin fashion. Configuration: CRM → Settings → Lead Distribution → Queue.
Queue parameters:
- List of managers in the queue and their order
- Working hours (leads outside working hours are assigned to an on-duty manager or placed in a holding pool)
- Exceptions: a lead is not assigned to a manager who is on leave or a business trip (integration with Absences)
Routing rules — a more flexible tool. Allows leads to be assigned based on conditions:
| Condition | Action |
|---|---|
| Source = «Moscow Website» | Assign to manager Ivanov |
| Source = «Cold Call» | Add to «Cold Calls» queue |
| Amount > 500,000 | Assign to senior manager |
| Region = «Krasnodar Region» | Manager Sidorov (regional) |
| UTM_campaign = «vk_retarget» | Add to «Retargeting» funnel |
Configuration: CRM → Settings → Routing Rules → Create Rule.
Distribution via Robots
Robots in the leads funnel offer finer-grained control with conditional logic. Example scheme:
New Lead
└─► [Robot: Check «Region» field]
├─► Moscow → [Robot: Set Responsible = Ivanov]
├─► St.Pete → [Robot: Set Responsible = Petrov]
└─► Other → [Robot: Add to «Regions» queue]
Robot configuration: CRM → Leads → Stage «New» → Automation → Add Robot → «Change Responsible».
Programmatic Distribution via REST API
For complex logic — distribution by manager workload, specialization, or geography — REST API and webhooks are used:
// Webhook on lead creation
// URL: /local/rest/lead_routing.php
$leadData = json_decode(file_get_contents('php://input'), true);
$leadId = $leadData['data']['FIELDS_AFTER']['ID'];
// Fetch lead data
$b24 = initBitrix24Client();
$lead = $b24->call('crm.lead.get', ['id' => $leadId]);
// Determine the responsible party using business logic
$responsibleId = determineResponsible($lead['result']);
// Assign
$b24->call('crm.lead.update', [
'id' => $leadId,
'fields' => ['ASSIGNED_BY_ID' => $responsibleId],
]);
// Notify the manager
$b24->call('im.notify.personal.add', [
'USER_ID' => $responsibleId,
'MESSAGE' => 'You have been assigned a new lead: ' . $lead['result']['TITLE'],
]);
function determineResponsible(array $lead): int
{
// By source
if ($lead['SOURCE_ID'] === 'SITE_MOSCOW') {
return MOSCOW_MANAGER_ID;
}
// By workload (pick the manager with the fewest open leads)
global $b24;
$managers = [MANAGER_1_ID, MANAGER_2_ID, MANAGER_3_ID];
$loads = [];
foreach ($managers as $managerId) {
$count = $b24->call('crm.lead.list', [
'filter' => ['ASSIGNED_BY_ID' => $managerId, 'STATUS_ID' => 'NEW'],
'select' => ['ID'],
])['total'];
$loads[$managerId] = $count;
}
asort($loads);
return array_key_first($loads);
}
Working Hours Awareness
Distribution should account for manager availability. Bitrix24 provides an API for checking working hours and absences:
// Check whether the manager is present
BX24.callMethod('timeman.timecontrol.report.list', {
filter: { USER_ID: managerId, STATUS: 'OPENED' },
}, result => {
const isOnline = result.total() > 0;
// If absent — redirect to the on-duty manager
});
Timeline
| Configuration | Timeline |
|---|---|
| Round-robin queue + working hours | 0.5–1 day |
| Routing rules + robots | 1–2 days |
| Custom logic via REST + webhooks | 3–6 days |







