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 | 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.







