Setting up geofencing notifications for 1C-Bitrix

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
    1189
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    813
  • 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
    657
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Geofencing Notifications Setup for 1C-Bitrix

Geofencing — trigger firing when user enters or exits defined geographic zone. In Bitrix context, typically mobile app push: "You're near our store — 10% discount today."

Solution Components

Geofencing doesn't implement via Bitrix alone. Three components needed:

  1. Mobile app (iOS/Android) with background geolocation monitoring — registers zones, sends events to server
  2. Server API on Bitrix — receives enter/exit events, decides on notification send
  3. Push infrastructure — Firebase Cloud Messaging (FCM) for Android, APNs for iOS

Browser geofencing via Geolocation API works only with open tab, so full notifications require mobile app.

Zone Registration on App Side

Native SDKs support geofencing:

  • Android: com.google.android.gms.location.GeofencingClient
  • iOS: CLLocationManager with startMonitoring(for: CLCircularRegion)

App loads zone list on startup from Bitrix server, registers in system. On enter/exit, OS generates event — app sends POST to your API.

Bitrix API

Create REST endpoint /local/ajax/geofence-event.php:

<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';

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

$userId     = (int)$data['user_id'];
$zoneId     = (int)$data['zone_id'];
$eventType  = $data['event']; // 'enter' or 'exit'
$deviceToken = $data['device_token'];

if ($eventType === 'enter') {
    \Local\Geofence\NotificationService::sendEnterZoneNotification(
        $userId,
        $zoneId,
        $deviceToken
    );
}

Zone Storage

Use HL-infoblock GeoZones:

Field Type Description
UF_NAME String Zone name
UF_LAT Float Center latitude
UF_LNG Float Center longitude
UF_RADIUS Integer Radius in meters
UF_NOTIFICATION_TEXT Text Push text
UF_ACTIVE Flag Zone active

Push Send via FCM

namespace Local\Geofence;

class NotificationService {
    private const FCM_URL = 'https://fcm.googleapis.com/fcm/send';

    public static function sendEnterZoneNotification(
        int $userId,
        int $zoneId,
        string $deviceToken
    ): void {
        $zone = \Local\Geofence\GeoZoneTable::getById($zoneId)->fetch();
        if (!$zone || $zone['UF_ACTIVE'] !== true) return;

        $payload = [
            'to' => $deviceToken,
            'notification' => [
                'title' => 'You're near us',
                'body'  => $zone['UF_NOTIFICATION_TEXT'],
            ],
        ];

        $http = new \Bitrix\Main\Web\HttpClient();
        $http->setHeader('Authorization', 'key=' . FCM_SERVER_KEY);
        $http->setHeader('Content-Type', 'application/json');
        $http->post(self::FCM_URL, json_encode($payload));
    }
}

Limits and Antispam

Without limits, user passing store multiple times daily gets same notifications. Add cooldown: log sent notifications in table, don't resend if last notification for this zone < N hours ago.

Stage Time
Zone structure and API design 3–4 h
Server API development 6–10 h
FCM / APNs setup 2–3 h
Mobile app integration 8–16 h
Cooldown and antispam 2–4 h