Bitrix eSputnik Integration: Code, Sync, Personalization

Manual customer segmentation and trigger email setup take hours, and without clear data synchronization between 1C-Bitrix and eSputnik, sales are lost. We set up the integration turnkey: we link contacts, events, and product recommendations via API to automate communications. Our team handles the entire cycle—from audit to support—ensuring stable operation and growing personalization alongside your business.

Our competencies:

Frequently Asked Questions

eSputnik is a Customer Data Platform focused on ecommerce: omnichannel chains, dynamic recommendations, abandoned cart. Integrating it with Bitrix via REST API requires understanding eSputnik's event model — without a clear data schema, synchronization quickly becomes chaotic. We have completed over 20 such integrations. Typical case: a store with 50,000 products where manual segmentation took 10 hours per week. After integration — automatic triggers and real-time personalization.

eSputnik API Features

eSputnik provides REST API v1 with Basic Auth (account login/password). Base URL: https://esputnik.com/api/v1/. Key difference from other ESPs: events as the main trigger mechanism. Instead of direct campaign management, we send events (order placed, cart updated, page viewed) — eSputnik builds automations on their own. This resembles webhooks but with its own queue and retries. Compare: manual trigger setup in MailChimp takes hours, in eSputnik — minutes.

How to Sync Contacts via REST API?

First step: API client for upserting contacts. In our code, we wrap the call in ESputnikClient class and pass channels (email) and fields (custom fields). Field IDs (id: 1, 2, 3) are taken from eSputnik account settings (Contacts → Additional fields). Important: if a field is not filled, do not pass it — eSputnik overwrites existing value with empty.

class ESputnikClient {
    private string $login;
    private string $password;
    private string $baseUrl = 'https://esputnik.com/api/v1/';

    public function upsertContact(array $contactData): array {
        $http = new \Bitrix\Main\Web\HttpClient();
        $auth = base64_encode($this->login . ':' . $this->password);
        $http->setHeader('Authorization', 'Basic ' . $auth);
        $http->setHeader('Content-Type', 'application/json');
        $http->setHeader('Accept', 'application/json');

        $payload = [
            'contacts' => [[
                'channels' => [
                    ['type' => 'email', 'value' => $contactData['email']],
                ],
                'fields' => [
                    ['id' => 1, 'value' => $contactData['first_name'] ?? ''],
                    ['id' => 2, 'value' => $contactData['last_name'] ?? ''],
                    ['id' => 3, 'value' => $contactData['phone'] ?? ''],
                ],
            ]],
        ];

        return json_decode($http->post($this->baseUrl . 'contact', json_encode($payload)), true);
    }
}

Why Are eSputnik Events More Effective Than Standard Email Triggers?

Typical ESPs force you to manually build segments and attach campaigns. eSputnik uses an event bus: you simply send an event with parameters, and the platform decides who and when gets the email. This allows chains like "If user didn't click in recommendation email within 3 days, send SMS with coupon" without writing code on the Bitrix side. Additionally, eSputnik automatically deduplicates contacts and manages sending frequency, reducing spam risk.

Here's how we send ecommerce events:

public function sendEvent(string $email, string $eventTypeKey, array $params): void {
    $http = new \Bitrix\Main\Web\HttpClient();
    // ... auth headers
    $payload = [
        'eventTypeKey' => $eventTypeKey,
        'keyValue' => $email,
        'params' => array_map(fn($k, $v) => ['name'=>$k,'value'=>$v], array_keys($params), $params),
    ];
    $http->post($this->baseUrl . 'event', json_encode($payload));
}

// Event: order placed
$esp->sendEvent($email, 'OrderCreated', [
    'orderId' => $orderId,
    'orderTotal' => $orderTotal,
    'currency' => 'RUB',
    'items' => json_encode($orderItems),
]);

// Event: product added to cart
$esp->sendEvent($email, 'CartUpdated', [
    'cartTotal' => $cartTotal,
    'items' => json_encode($cartItems),
]);

Case Study: Dynamic Recommendations in Emails

Situation. A sports nutrition store with 15,000 active buyers. Task: personalized emails with recommendations based on purchase history.

Implementation. We generated a product feed in XML/Google Shopping format from the Bitrix catalog and published it under a secure URL. eSputnik consumes the feed and uses collaborative filtering to select products. In the email editor, the "Recommendations" block automatically populates a selection for each recipient at open time (real-time rendering).

// /bitrix/components/custom/esputnik.feed/component.php
$products = CIBlockElement::GetList(
    ['SORT' => 'ASC'],
    ['IBLOCK_ID' => CATALOG_IBLOCK_ID, 'ACTIVE' => 'Y', 'CATALOG_AVAILABLE' => 'Y'],
    false,
    ['nTopCount' => 10000],
    ['ID', 'NAME', 'DETAIL_PAGE_URL', 'PREVIEW_PICTURE', 'PROPERTY_PRICE_RRP', 'PROPERTY_BRAND']
);
header('Content-Type: application/xml');
// ...

Result: CTR grew from 2.1% to 6.8% over three months. ROI was 5:1 due to automation and segmentation. Average open rate increased by 15%.

How to Set Up Product Feed for eSputnik?

The product feed is an XML file that eSputnik periodically loads for recommendations. We generate it on the fly via a Bitrix component, filtering only active and available products. Feed includes ID, name, URL, image, price, and brand. Example structure:

<feed>
  <entry>
    <id>12345</id>
    <name>Whey Gold Protein</name>
    <url>https://example.com/product/12345</url>
    <image>https://example.com/upload/iblock/abc.jpg</image>
    <price currency="RUR">1990.00</price>
    <brand>Optimum Nutrition</brand>
  </entry>
</feed>

The feed updates every 60 minutes via a Bitrix agent. eSputnik supports up to 100,000 products in the feed — for larger catalogs, we use incremental loading via API.

Contact Groups and Segmentation

eSputnik supports segmentation by contact fields and events. From Bitrix we pass fields: last order date (for reactivation), total purchase amount (VIP segment), purchased categories (thematic campaigns). Example segment: "users with more than 3 purchases totaling > 10,000 RUB in the last 90 days."

Task Effort
API client + contact sync 4–5 h
Ecommerce events (order, cart, view) 6–8 h
Product feed for recommendations 4–6 h
Trigger chain setup in eSputnik 4–8 h
Example error handling during sync

For network failures, we use retries with exponential backoff (max 3 attempts). We log failed calls to b_esputnik_log table for later analysis.

public function upsertContactWithRetry(array $data, int $retries = 3): array {
    for ($i = 0; $i < $retries; $i++) {
        try {
            return $this->upsertContact($data);
        } catch (\Exception $e) {
            if ($i === $retries - 1) throw $e;
            sleep(pow(2, $i));
        }
    }
}

What's Included

  • development of an API client with recursive sync support (error handling, retries, logging)
  • setup of ecommerce events: order placed, cart, product view, registration
  • product feed generation with custom fields (brand, category, price)
  • segment creation in eSputnik and linking to chains
  • scenario testing and delivery monitoring
  • system administration documentation

We guarantee correct data transmission and proper handling of all states (order cancellation, return). After handover, we remain on support — fix errors, update for new API versions.

Contact us — we will evaluate your store in 1 day and propose the optimal integration architecture. Order a pilot: we will connect one event sending and show how it works in your environment.

eSputnik API Documentation: https://esputnik.com/api/v1/docs