Setting up 1C-Bitrix delivery status notifications

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.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • 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
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Setting Up Delivery Status Notifications in 1C-Bitrix

Delivery status change notifications are one of the key customer communications after an order is placed. "Your order has been shipped," "Arrived in your city," "Courier is on the way" — each such message reduces the support workload and increases customer loyalty. Technically this is a combination of tracking with the 1C-Bitrix event system.

Notification types

Email — the standard channel, configured through 1C-Bitrix mail events. Suitable for non-urgent statuses: "Order shipped," "Arrived at warehouse."

SMS — critical notifications: "Courier is on the way," "Order is waiting at pickup point." Requires an SMS provider to be connected.

Push — for stores with a mobile app or PWA.

Email notifications via 1C-Bitrix events

// Event type registration (once, at installation)
\Bitrix\Main\EventManager::getInstance()->registerEventHandler(
    'main', 'OnBeforeEventSend',
    'my_module', \My\DeliveryNotification::class, 'onBeforeEventSend'
);

Create a mail event DELIVERY_STATUS_UPDATE in the section Settings → Mail → Mail Event Types:

  • Fields: ORDER_ID, STATUS_NAME, TRACK_NUMBER, DELIVERY_NAME, ORDER_URL

The letter template (Settings → Mail → Mail Templates) uses these fields. Different statuses get different templates: the texts for "Shipped" and "Waiting at pickup point" differ.

Notification trigger

class DeliveryStatusNotifier
{
    public static function notify(int $orderId, string $oldStatus, string $newStatus): void
    {
        // Not all statuses require a notification
        $notifiableStatuses = [
            'SHIPPED'         => 'Order shipped',
            'ARRIVED_CITY'    => 'Arrived in your city',
            'IN_PVZ'          => 'Waiting at pickup point',
            'OUT_FOR_DELIVERY' => 'Courier is on the way',
            'DELIVERED'       => 'Order delivered',
        ];

        if (!isset($notifiableStatuses[$newStatus])) return;

        $order = \Bitrix\Sale\Order::load($orderId);
        if (!$order) return;

        $props = $order->getPropertyCollection();

        \Bitrix\Main\Mail\Event::send([
            'EVENT_NAME' => 'DELIVERY_STATUS_UPDATE',
            'LID'        => $order->getSiteId(),
            'C_FIELDS'   => [
                'ORDER_ID'      => $orderId,
                'STATUS_NAME'   => $notifiableStatuses[$newStatus],
                'TRACK_NUMBER'  => $props->getItemByOrderPropertyCode('TRACKING_CODE')?->getValue(),
                'EMAIL'         => $props->getItemByOrderPropertyCode('EMAIL')?->getValue(),
                'ORDER_URL'     => $this->getOrderUrl($orderId),
            ],
        ]);
    }
}

SMS notifications

SMS is connected via a provider (SMSC.ru, SMS.ru, Devino, etc.). The general scheme: when the status changes, send an HTTP request to the provider's API.

private function sendSms(string $phone, string $message): void
{
    $response = $this->httpClient->get(
        'https://smsc.ru/sys/send.php',
        [
            'login'   => $this->getOption('SMS_LOGIN'),
            'psw'     => $this->getOption('SMS_PASSWORD'),
            'phones'  => $phone,
            'mes'     => $message,
            'sender'  => $this->getOption('SMS_SENDER'),
        ]
    );

    if (strpos($response, 'OK') === false) {
        \Bitrix\Main\Diag\Debug::writeToFile('SMS error: ' . $response, 'sms');
    }
}

SMS only for the statuses "Courier is on the way" and "Waiting at pickup point" — avoid spamming the customer.

Important nuance: notification frequency

Do not notify about every intermediate status. The customer does not want to receive 8 emails about the stages of the parcel's journey — only about significant events. Table of recommended notifications:

Status Email SMS
Shipped Yes No
Arrived in city No No
Waiting at pickup point Yes Yes
Courier on the way No Yes
Delivered Yes No

Protection against duplicate notifications

The polling agent may query the status several times in a row and receive the same status as before. Without protection, the customer will receive a repeated notification.

private static function alreadyNotified(int $orderId, string $status): bool
{
    $existing = \Bitrix\Sale\Internals\OrderTable::getList([
        'filter' => [
            'ID'      => $orderId,
            '=COMMENTS' => '%NOTIFIED:' . $status . '%',
        ],
    ])->fetch();
    return (bool)$existing;
}

Simpler: store sent notifications as a bitmask or JSON in a separate field/order property. Check before sending — if the status has already been sent, skip it.

Notification templates: what to write

Templates for each status are stored in 1C-Bitrix events. Minimum content for each template:

  • Shipped: tracking number, delivery service name, link to tracking on the service's website
  • Waiting at pickup point: pickup point address, business hours, storage period (7–14 days)
  • Delivered: thank you message, link to reorder or leave a review

Templates are created in the section Settings → Mail → Mail Templates. Each event type gets its own template with a proper subject line.

Implementation timelines

Setting up email notifications with templates for 3–5 statuses — 1 working day. Adding SMS and duplicate protection — +1 day. Full system with custom templates for each status and each delivery service — 2–2.5 days.