Integration · CLI

AmoCRM Migration & Sync

Two TypeScript CLI tools for migrating leads/contacts/notes between amoCRM accounts and synchronizing responsible users.

2024·Backend
TypeScriptNode.jsaxiosamoCRM API v4

Context

A subscription change and a reorganization of the sales department required transferring data between two amoCRM accounts while preserving relationships: lead → contact → notes, and reassigning the responsible users via a mapping table.

Solution

Two independent CLIs:

  • Migration — iterates over the source account's leads page by page, pulls contacts and notes for each one, creates the entities in the new account, links them (linkContactsToLead), and transfers the notes. Supports TEST_MODE for a dry run.
  • Responsible sync — walks through the leads, applies the USER_MAP mapping, reassigns responsible_user_id via PATCH, and provides DRY_RUN and TEST_LIMIT for a pre-run.

Stack and architecture

  • Runtime: Node.js, TypeScript 5.
  • HTTP: axios with the amoGet / amoPatch retry wrapper.
  • Config: dotenv (tokens, base URLs, mapping table).
  • Build: tsc → dist/.

Role and outcome

We built both tools for the specific configurations, working around amoCRM's rate limits while preserving note history and relationships. The transfer completed with no data loss, and the responsible-user reassignment was done in a single night.

Similar project?

Discuss a similar task

Describe the task — we'll share relevant experience and estimate the implementation.