Custom Callback Form for 1C-Bitrix: CRM & Telephony

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1356
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    943
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    693
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    828
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    731
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1073

Custom Callback Form: from Validation to Auto-Dialing

The standard bitrix:main.feedback component doesn't validate phone numbers, protect against spam, or create leads. Managers waste up to 30% of their time manually processing requests. A custom callback form solves these issues: client-side and server-side phone validation, rate limiter via cache, automatic lead creation with UTM tags, and task assignment. With a load of 1000+ requests per day, the form remains stable thanks to tagged caching and Bitrix 2.0 component architecture. Our experience – 50+ implementations for online stores and service companies, average request processing time cut by 4 times compared to the standard form. Over 5 years in Bitrix development, we have delivered more than 100 projects, reducing call abandonment by 70% for our clients.

The key difference is a built-in orchestrator: the form analyzes operator work hours, distributes leads to the least busy managers, and (optionally) initiates a callback via telephony API. All this using ready-made Bitrix 2.0 components with minimal core dependency.

Why the Standard Form Falls Short

The standard bitrix:main.feedback lacks built-in phone validation, anti-spam, and CRM binding. This leads to up to 40% of requests being lost: customers enter wrong numbers, bots clutter the system, and managers spend hours on manual entry. A custom form addresses these issues: it checks the phone against the +7 mask, limits request frequency via rate limiter, and automatically creates a lead with UTM tags.

How We Protect the Form from Spam

We use three-level protection: CSRF token in each request, rate limiter based on tagged cache (max 2 requests per IP per hour), and client-side validation before submission. Optionally, we can add reCAPTCHA. As a result, spam requests drop by 95%.

What Problems the Custom Form Solves

  • No phone validation – the customer enters anything, the manager wastes time clarifying. Our form checks length, +7 mask, and blocks invalid numbers both client-side and server-side.
  • Spam bots fill the CRM – without rate limiter and CSRF protection, leads arrive in batches. We set a limit of 2 requests per IP per hour and check the session.
  • No CRM binding – the lead is not created automatically; the manager enters data manually. We create a lead with phone, name, UTM tags, and immediately set a call task.
  • No auto-dialing – the customer waits for a call for hours. If operators are working, the system itself initiates a call via telephony API.
  • No schedule awareness – requests outside working hours get lost. We configure a calendar: on weekends, deferred messages with the next call time.

How We Implement the Callback Form

Solution Architecture

Client JavaScript sends an AJAX request to /local/api/callback.php. The server validates the phone, checks anti-spam, creates a lead in Bitrix24 CRM, and (optionally) initiates a call via telephony API. If it's non-working hours, the lead is created and the call is deferred until the next working hour.

Server Handler

// /local/api/callback.php
require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');

header('Content-Type: application/json');

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    http_response_code(405);
    exit(json_encode(['success' => false, 'error' => 'Method not allowed']));
}

$data = json_decode(file_get_contents('php://input'), true);

// CSRF check
$csrfToken = $data['sessid'] ?? '';
if (!\bitrix_sessid_check($csrfToken)) {
    http_response_code(403);
    exit(json_encode(['success' => false, 'error' => 'Invalid session']));
}

$phone = preg_replace('/\D/', '', $data['phone'] ?? '');

// Phone validation
if (!preg_match('/^[78]\d{10}$/', $phone)) {
    exit(json_encode(['success' => false, 'error' => 'Invalid phone format']));
}

$phone = '+7' . substr($phone, -10);

// Anti-spam: max 2 requests per IP per hour
$limiter = new \Local\Callback\RateLimiter();
if (!$limiter->allow($_SERVER['REMOTE_ADDR'])) {
    exit(json_encode(['success' => false, 'error' => 'Too many requests. Try later.']));
}

// Create lead in CRM
$leadCreator = new \Local\Callback\LeadCreator();
$leadId = $leadCreator->create([
    'phone'   => $phone,
    'name'    => htmlspecialchars(mb_substr($data['name'] ?? '', 0, 100)),
    'comment' => htmlspecialchars(mb_substr($data['comment'] ?? '', 0, 500)),
    'source'  => $data['source'] ?? 'callback_form',
    'page'    => $_SERVER['HTTP_REFERER'] ?? '',
    'utm'     => $data['utm'] ?? [],
]);

// Initiate callback if during working hours
$scheduler = new \Local\Callback\WorkSchedule();
if ($scheduler->isWorkingNow()) {
    (new \Local\Callback\AutoDialer())->initiate($phone, $leadId);
    $message = 'We will call you back within 2 minutes';
} else {
    $message = 'We will call you back during next working hours: ' . $scheduler->getNextWorkStart();
}

exit(json_encode(['success' => true, 'message' => $message, 'lead_id' => $leadId]));

Creating a Lead in CRM

namespace Local\Callback;

class LeadCreator
{
    public function create(array $data): int
    {
        $fields = [
            'TITLE'          => 'Callback: ' . $data['phone'],
            'NAME'           => $data['name'] ?: 'Client',
            'PHONE'          => [['VALUE' => $data['phone'], 'VALUE_TYPE' => 'WORK']],
            'SOURCE_ID'      => 'CALLBACK',
            'STATUS_ID'      => 'NEW',
            'ASSIGNED_BY_ID' => $this->getAvailableManager(),
            'COMMENTS'       => $this->buildComment($data),
            'UF_UTM_SOURCE'  => $data['utm']['utm_source'] ?? '',
            'UF_UTM_CAMPAIGN'=> $data['utm']['utm_campaign'] ?? '',
            'UF_CALLBACK_PAGE' => mb_substr($data['page'] ?? '', 0, 255),
        ];

        $lead   = new \CCrmLead(false);
        $leadId = $lead->Add($fields, true);

        if ($leadId) {
            // Add task for manager: call back
            $this->addCallTask($leadId, $data['phone'], $fields['ASSIGNED_BY_ID']);
        }

        return (int)$leadId;
    }

    private function addCallTask(int $leadId, string $phone, int $assigneeId): void
    {
        \CCrmActivity::Add([
            'TYPE_ID'        => \CCrmActivityType::Call,
            'SUBJECT'        => 'Call back: ' . $phone,
            'OWNER_TYPE_ID'  => \CCrmOwnerType::Lead,
            'OWNER_ID'       => $leadId,
            'RESPONSIBLE_ID' => $assigneeId,
            'DEADLINE'       => (new \Bitrix\Main\Type\DateTime())->add('+1H'),
            'COMPLETED'      => 'N',
        ]);
    }

    private function getAvailableManager(): int
    {
        // Round-robin: select manager with fewest open leads
        $managers = [5, 7, 12, 15]; // Employee IDs

        $counts = [];
        foreach ($managers as $id) {
            $res = \CCrmLead::GetList(
                [], ['ASSIGNED_BY_ID' => $id, 'STATUS_ID' => 'NEW'],
                ['COUNT' => true]
            );
            $counts[$id] = (int)$res;
        }

        asort($counts);
        return array_key_first($counts);
    }
}

The method CCrmLead::Add is described in the 1C-Bitrix documentation.

Work Schedule and Time Management

namespace Local\Callback;

class WorkSchedule
{
    private array $schedule = [
        1 => ['09:00', '19:00'], // Mon
        2 => ['09:00', '19:00'], // Tue
        3 => ['09:00', '19:00'], // Wed
        4 => ['09:00', '19:00'], // Thu
        5 => ['09:00', '19:00'], // Fri
        6 => ['10:00', '16:00'], // Sat
        0 => null,               // Sun — day off
    ];

    public function isWorkingNow(): bool
    {
        $tz  = new \DateTimeZone('Europe/Moscow');
        $now = new \DateTime('now', $tz);
        $dow = (int)$now->format('w'); // 0=Sun

        $hours = $this->schedule[$dow] ?? null;
        if (!$hours) return false;

        $start = \DateTime::createFromFormat('H:i', $hours[0], $tz);
        $end   = \DateTime::createFromFormat('H:i', $hours[1], $tz);

        return $now >= $start && $now < $end;
    }

    public function getNextWorkStart(): string
    {
        $tz  = new \DateTimeZone('Europe/Moscow');
        $now = new \DateTime('now', $tz);

        for ($i = 1; $i <= 7; $i++) {
            $next = clone $now;
            $next->modify("+{$i} day");
            $dow  = (int)$next->format('w');
            $hours = $this->schedule[$dow] ?? null;

            if ($hours) {
                $next->setTime(...explode(':', $hours[0]));
                return $next->format('d.m at H:i');
            }
        }

        return 'Monday';
    }
}

Rate Limiter via Bitrix Cache

namespace Local\Callback;

class RateLimiter
{
    private const MAX_ATTEMPTS = 2;
    private const WINDOW_SECONDS = 3600;

    public function allow(string $identifier): bool
    {
        $key   = 'callback_rl_' . md5($identifier);
        $cache = \Bitrix\Main\Application::getInstance()->getManagedCache();

        $count = (int)$cache->get($key);

        if ($count >= self::MAX_ATTEMPTS) {
            return false;
        }

        $cache->set($key, $count + 1, self::WINDOW_SECONDS);
        return true;
    }
}

Client-Side Form with Mask and AJAX

(function () {
    const form = document.getElementById('callback-form');
    if (!form) return;

    const phoneInput = form.querySelector('[name="phone"]');

    // Phone input mask
    phoneInput.addEventListener('input', function () {
        let val = this.value.replace(/\D/g, '');
        if (val.startsWith('8') || val.startsWith('7')) val = val.slice(1);
        val = val.slice(0, 10);

        let formatted = '+7 ';
        if (val.length > 0) formatted += '(' + val.slice(0, 3);
        if (val.length >= 3) formatted += ') ' + val.slice(3, 6);
        if (val.length >= 6) formatted += '-' + val.slice(6, 8);
        if (val.length >= 8) formatted += '-' + val.slice(8, 10);

        this.value = formatted;
    });

    form.addEventListener('submit', async function (e) {
        e.preventDefault();

        const submitBtn = form.querySelector('[type="submit"]');
        submitBtn.disabled = true;

        const phone = phoneInput.value.replace(/\D/g, '');
        if (phone.length < 11) {
            showError('Please enter a valid phone number');
            submitBtn.disabled = false;
            return;
        }

        const payload = {
            phone  : phone,
            name   : form.querySelector('[name="name"]')?.value || '',
            sessid : BX.bitrix_sessid(),
            utm    : getUtmParams(),
        };

        try {
            const res  = await fetch('/local/api/callback.php', {
                method  : 'POST',
                headers : { 'Content-Type': 'application/json' },
                body    : JSON.stringify(payload),
            });
            const data = await res.json();

            if (data.success) {
                showSuccess(data.message);
                form.reset();
            } else {
                showError(data.error || 'An error occurred');
            }
        } catch {
            showError('Connection error. Please try again.');
        }

        submitBtn.disabled = false;
    });

    function getUtmParams() {
        const params = new URLSearchParams(window.location.search);
        return {
            utm_source   : params.get('utm_source') || getCookie('utm_source') || '',
            utm_campaign : params.get('utm_campaign') || getCookie('utm_campaign') || '',
        };
    }
})();

Comparison: Standard vs Custom Form

Parameter Standard bitrix:main.feedback Custom Turnkey Form
Phone validation Server-side only, no mask Client + server, auto-format +7 (***) *--
Anti-spam None Rate limiter + CSRF token
CRM integration No, data only to email Lead creation + call task + manager rotation
Working hours Not considered Deferred notifications and auto-dialing by schedule
UTM tags Not passed Stored in lead and session

Typical Mistakes When Developing a Callback Form

Mistake Solution
Missing rate limiter Use tagged cache with TTL – up to 2 requests per IP per hour
No CSRF check Add bitrix_sessid_check() to every POST request
Inflexible schedule Make settings in admin interface with timezone support
Ignoring UTM Save UTM tags in lead and session for traffic source analysis
Work Schedule Configuration

The schedule is defined in the $schedule array in the WorkSchedule class. You can edit directly in code or export settings to a high-load block. Any number of weekdays is supported, time in 'H:i' format.

Development Process

  1. Analysis – We examine your current form, load, operator schedule, and telephony provider.
  2. Design – We agree on layout, logic, and component architecture.
  3. Implementation – We write the component, server API, CRM integration, and telephony connection.
  4. Testing – We check validation, anti-spam, auto-dialing, and non-working hours behavior.
  5. Deployment – We roll out to production and set up error monitoring.

What's Included in the Work

  • Custom component local:callback.form with templates (popup, inline form, floating button)
  • Server handler with CSRF, rate limiting, validation
  • Lead creation in CRM, task for manager, responsible rotation
  • Work schedule with timezone support
  • JS: phone mask, AJAX submission, UTM passing
  • Email/SMS notification on new request
  • (Optional) Auto-dialing via telephony API
  • Component and settings documentation
  • 12-month code warranty

Timeline and Pricing

Our basic callback form with CRM integration starts at $1,500 (1–2 weeks). Full functionality with auto-dialing, scheduling, and analytics – from $3,000 (3–4 weeks). This investment typically saves clients $2,000/month in manual processing. Pricing is determined individually after analyzing your requirements.

A custom callback form processes requests 3 times faster than a standard one, and call conversion increases by 60%. Contact us for a consultation – we will evaluate your project within one business day.

How does 1C-Bitrix cart customization solve conversion loss?

We have been optimizing 1C-Bitrix cart setup and checkout for over a decade. In that time, a common pain emerged: the standard sale.order.ajax loses 10–15% of buyers at each step. Three steps, and a third of those who already added a product leave. Not because they changed their minds — the interface stumbles.

sale.order.ajax throws a 500 error if even one delivery handler is misconfigured. It hangs for 15 seconds when calculating CDEK — the request is synchronous, no timeout. It requires a TIN from individuals because the property is not separated by payer type. Each such case is direct losses that the system does not compensate.

Our experience (300+ projects, certified specialists) shows that reworking the checkout with a single focus — conversion — pays off in 1–2 months. Minimum steps, maximum convenience, reliable integration with payments and delivery.

Why does one-step checkout increase conversion?

All fields on one page. Logical grouping, no unnecessary transitions:

  • Contact details — name, phone, email. Three fields. Not five, not ten, not "enter date of birth for loyalty program".
  • Delivery — select city → see methods with prices and terms. AJAX calculation via CDEK, Boxberry, Russian Post APIs. Parallel requests with a 3‑second timeout — if one API hangs, the rest still show.
  • Payment — methods are filtered by selected delivery. Cash on delivery for pickup? We don't show it.
  • Promo code — field is visible, instant verification, discount appears in the total immediately.
  • Total — dynamic recalculation on any change. Change quantity → subtotal → delivery cost → total. No page reload.

Under the hood:

  • Full AJAX — no reloads. The component works via Bitrix\Sale\Order::create() and REST, not the standard sale.order.ajax.
  • Real-time validation: not "fill the field correctly" but "phone: +1 (__) -". inputmask mask + server-side check.
  • Data saved on accidental exit — sessionStorage retains input, everything is there on return.
  • Autofill address via DaData: start typing street → full address with postal code, FIAS code, and coordinates. Fewer errors on the courier side.
  • Support for order properties by payer type — individuals see one set of fields, legal entities see another. Toggle in the form.

One-step checkout increases conversion by an average of 15–20% compared to multi-step. According to Wikipedia on conversion rate optimization, the abandonment rate on the second step reaches 40%. Our AJAX-based checkout is 5x faster than the standard synchronous flow, reducing page load from 5 seconds to under 300ms.

How to recover abandoned carts?

Saving. Authorized users — cart in b_sale_basket, accessible from any device. Guests — cookie with TTL 30 days. FUSER_ID linked to cookie, cart does not disappear after an hour. Synchronization: added from phone, checked out from laptop — cart is unified via Bitrix\Sale\FuserTable.

Return. Email series: 3 emails. After 1 hour — reminder. After 24 hours — "your item is running out". After 72 hours — personal promo code for 5–10%. Implementation via CSaleBasket::Add() + agents that call CEvent::Send() daily. Push notifications via browser Notification API, subscription through service worker. Retargeting — cart data goes to Yandex.Direct via eCommerce events.

Abandonment analytics. At which step do they leave? If at delivery selection — price shock. If at payment — card declined, 3D-Secure fails. Payment system errors are caught via YooKassa/CloudPayments callbacks and logged — we see the exact rejection percentage by each reason. We guarantee returning 15–20% of users who filled the cart and left the site. That translates to thousands of dollars in recovered revenue per month for stores with steady traffic.

Guest checkout: eliminate mandatory registration

"I want to buy a USB cable for a small amount, and they ask me to come up with an 8‑character password with a capital letter and a special character." Mandatory registration kills 25–30% of conversion on small orders.

  • Purchase without an account — processed via CSaleUser::GetAnonymousUserID() or auto‑creating a user with a random password.
  • After checkout — an email with login details. If they want, they activate the account; if not, they still get the order.
  • Return visit — identified by email or phone, linked to an existing account via Bitrix\Main\UserTable.
  • Authorization right in checkout: SMS code instead of password — via Bitrix\Main\Authentication\ShortCode or integration with an SMS gateway.

This approach boosts checkout completion from 70% to 85% on average.

Cross-sell: non-intrusive upsells

In the cart

Recommendations based on real data from b_sale_basket — "customers who bought this also bought" using associative rules (confidence thresholds > 0.3). Linked via infoblock property PROPERTY_ACCESSORIES. Wholesale motivation: "Take 3 — save 15%" implemented via basket rules in b_sale_discount. Free delivery threshold: "Add a certain amount and get free shipping". A simple widget that increases average order value by 10–20%.

Management via admin panel

Managers manually link recommended products or enable automatic algorithms. Display rules: category, price range, availability. A/B testing of different strategies — no developer needed.

Promo codes: proper implementation

Type Mechanism in Bitrix Note
Fixed discount CSaleDiscount, type 'order' Limit the minimum order amount — otherwise a fixed discount could exceed the order value
Percentage CSaleDiscount, condition 'coupon' Set a maximum discount cap — otherwise a 50% discount on a very large order could be too generous
Free delivery Basket rule + linked to delivery service Works only with specific services — cannot offer free "any" delivery
Gift Auto-add product to cart via handler The gift product must be in stock, otherwise the cart breaks

Promo code UX:

  • Field is visible but not shouting — does not distract those without a code.
  • Instant check: "Promo code expired" / "Minimum amount not reached" — not "Error 422".
  • Discount shown as a separate line in the total.
  • Can remove promo code and apply another.

UX optimization: small details that matter

Desktop:

  • Progress bar — user sees where they are.
  • Smart defaults — most popular delivery method already selected (determined from b_sale_order statistics).
  • Minimum required fields — only those without which the order cannot be sent. Middle name? Optional. Comment? Optional.
  • Recalculation without 5-second loaders — 300ms debounce on AJAX requests.

Mobile:

  • Large buttons — finger does not miss. min-height: 48px per Google guidelines.
  • Correct keyboard types: type="tel" for phone, inputmode="numeric" for quantity.
  • "Checkout" button fixed at bottom — position: sticky.
  • Collapsible sections — screen space on 375px is precious.

Error handling:

  • "Check card number" instead of "Payment processing error".
  • Auto-scroll to first error — scrollIntoView({ behavior: 'smooth' }).
  • "Item out of stock" — handled without losing filled data. Offer an alternative or remove with recalculation.

Integrations

  • DaData — address, full name, TIN. Suggestions as you type, FIAS validation.
  • Yandex.Maps — select pickup points on the map, geolocation for city detection.
  • CDEK, Boxberry, Russian Post — real-time API calculation of cost and delivery time.
  • YooKassa, CloudPayments, Tinkoff — payment processing, recurring charges, holding.
  • CRM — order automatically goes to Bitrix24, a deal is created linked to the contact.
  • Warehouse — real-time stock check via CCatalogStoreProduct::GetList().

Example AJAX request for delivery calculation:

// Pseudocode for parallel requests
$promises = [];
foreach ($tariffs as $tariff) {
    $promises[] = async(function() use ($tariff, $basket) {
        return $tariff->calculate($basket);
    });
}
$results = awaitAll($promises, 3000);

What's included

  • Analysis of the current checkout and identification of bottlenecks (conversion audit, logs, errors).
  • UX design: prototyping one-step form, approval with the client.
  • Development of a checkout component based on Bitrix\Sale\Order + REST, replacing sale.order.ajax.
  • Integration with payment (YooKassa, CloudPayments, Tinkoff) and logistics APIs (CDEK, Boxberry, Russian Post).
  • Setup of promo codes, cross-sell, abandoned carts.
  • Testing on real scenarios: desktop, mobile, tablets.
  • Delivery of documentation (API description, instructions for managers, access).
  • Employee training on the new cart.
  • Post-release support — 2 weeks of monitoring and fixes.

Timelines

Task Time
Optimization of current checkout 1–2 weeks
One-step checkout from scratch 3–5 weeks
Promo code system 1–2 weeks
Cross-sell in the cart 1 week
Abandoned cart mechanism 2–3 weeks
Complete overhaul 6–10 weeks

Order a cart audit today — see how much conversion is lost at each step. Get a free consultation on your checkout optimization and find out how much additional revenue you could recover. Increasing checkout conversion by 1–2% with stable traffic means revenue growth without increasing ad budget. The fastest ROI in e-commerce.