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. SupportsTEST_MODEfor a dry run. - Responsible sync — walks through the leads, applies the
USER_MAPmapping, reassignsresponsible_user_idvia PATCH, and providesDRY_RUNandTEST_LIMITfor a pre-run.
Stack and architecture
- Runtime: Node.js, TypeScript 5.
- HTTP: axios with the
amoGet/amoPatchretry 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.