---
title: "ERP / 1C contact sync"
description: "Two-way contact sync between Bitrix24 and an external ERP. Match by INN (primary) or email (fallback). Cron every hour."
canonical_url: "https://bitrix24.github.io/b24jssdk/docs/examples/erp-sync"
last_updated: "2026-06-02"
---
# ERP / 1C contact sync

> Two-way contact sync between Bitrix24 and an external ERP. Match by INN (primary) or email (fallback). Cron every hour.

## What it does

Pulls contacts from both Bitrix24 (via `actions.v2.fetchList.make`) and an external ERP (mocked in the recipe — replace with your client). Matches them by tax id (`ufCrmInn`) primarily and email as a fallback. Creates missing rows on each side and syncs changed name fields back to Bitrix24.

## Stack

Node.js 18+, `node-cron`.

## Install

```bash
pnpm add node-cron
```

## Environment

```bash
export B24_HOOK='https://your.bitrix24.com/rest/1/secret'
```

## Run

```bash
npx tsx 04-erp-sync.ts
```

## Source

[`skills/b24jssdk-recipes/examples/04-erp-sync.ts`](https://github.com/bitrix24/b24jssdk/blob/main/skills/b24jssdk-recipes/examples/04-erp-sync.ts).

## Notes

- ERP-side functions (`fetchErpContacts`, `createErpContact`, `updateErpContact`) are stubs. Plug in your client (1C OData, REST, etc.).
- The matching key is `ufCrmInn` — adjust the field name to whatever your custom-field namespace uses.
- For thousands of contacts the per-row `createBitrixContact` await loop is the bottleneck. Replace it with `actions.v2.batchByChunk.make({ calls: erpContacts.map((e) => ['crm.item.add', { entityTypeId: 3, fields: ... }]), options: { isHaltOnError: false } })` — see [recipe 5 (Disk files)](https://bitrix24.github.io/b24jssdk/raw/docs/examples/disk-files.md) for the basic `batch.make` shape and the `b24jssdk-rest` skill for `batchByChunk.make` details.

## Sitemap

See the full [sitemap](/b24jssdk/sitemap.md) for all pages.
