Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipedrive Person Sync

A simple script to sync person data to Pipedrive CRM.

Setup

  1. Install dependencies:
pnpm install
  1. Create a .env file in the root folder:
PIPEDRIVE_API_KEY=your_api_key_here
PIPEDRIVE_COMPANY_DOMAIN=your_company_domain
  1. Run the script:
pnpm build
pnpm start

How It Works

  • Reads person data from src/mappings/inputData.json
  • Uses field mappings from src/mappings/mappings.json to map input fields to Pipedrive fields
  • For each person:
    • Searches if person already exists (by name)
    • If found → updates the person
    • If not found → creates new person

Edge Cases Handled

1. Multiple Persons (Array Input)

The input data can be a single object or an array of objects. The script handles both cases - if you pass an array, it processes each person one by one.

Pipedrive doesn't have a bulk create API, so we loop through and add a small delay between requests to avoid hitting rate limits.

2. Rate Limiting (429 Error)

If Pipedrive returns a 429 (too many requests), the script waits for the time specified in the Retry-After header and then retries the same request.

3. Missing or Empty Fields

If a person in the array has an empty name or no valid data to sync, the script skips that person and continues with the rest. It doesn't fail the entire batch because of one bad entry.

4. Partial Match Prevention

Pipedrive search returns partial matches (searching "John" might return "John Smith", "Johnny", etc.). The script does an exact name comparison after search to make sure we're updating the right person.

5. Invalid Configuration

If API key or company domain is missing/empty in the .env file, the script throws a clear error message instead of failing with a confusing API error later.

Project Structure

src/
  index.ts          - Main sync logic
  mappings/
    inputData.json  - Person data to sync
    mappings.json   - Field mappings (pipedrive field → input field)
  types/
    pipedrive.ts    - TypeScript types

Notes

  • The script uses the v1 Pipedrive API
  • Name field is required for person lookup
  • Empty values in input data are skipped (not sent to Pipedrive)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages