Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipedrive Data Synchronization

A small TypeScript script that maps person data from inputData.json using mappings.json and synchronizes it with Pipedrive.

Setup

npm install

Create .env in the project root:

PIPEDRIVE_API_KEY=your_api_token
PIPEDRIVE_COMPANY_DOMAIN=your_company_domain

Run the project:

npm run dev

For the compiled version:

npm run build
npm start

Run the mapping checks with:

npm test

How it works

  1. Read the input person and field mappings.
  2. Build a Pipedrive person payload from the mappings.
  3. Find the mapping for name and use its input value to search Pipedrive.
  4. Update the matching person when one exact match is found.
  5. Create a new person when no match is found.
  6. Stop instead of guessing when multiple exact matches are returned.

Email and phone mappings are converted to Pipedrive's emails and phones arrays. Dot-separated input paths such as phone.home are supported.

Edge cases

  • Missing name mapping: the sync stops because the name is required to find the existing person.
  • Empty mapped name: the sync stops before making an API request.
  • Multiple exact matches: the sync stops instead of updating an arbitrary person.
  • API/network failure: the Pipedrive client throws an error with the HTTP status or network failure so the caller can exit cleanly.

Project structure

src/
  index.ts
  lib/
    mapping.ts
    mapping.test.ts
    pipedrive.ts
  mappings/
    inputData.json
    mappings.json
  types/
    mapping.ts
    pipedrive.ts

The mapping functions are kept separate from the Pipedrive client so the data transformation can be tested without making real API requests.

Notes

The API token is read from the environment and is not part of the source code. Do not commit .env.

About

TypeScript tool that maps structured JSON person data via config files and synchronizes it with the Pipedrive CRM API. Features duplicate prevention, automated contact lookup, and robust edge-case handling.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages