An open API service indexing awesome lists of open source software.

https://github.com/rollecode/pipedrive-email-archiver

Pipedrive doesn't offer batch archiving of emails through the UI, but you can archive them using the API with this tool.
https://github.com/rollecode/pipedrive-email-archiver

archiver email pipedrive pipedrive-api

Last synced: 27 days ago
JSON representation

Pipedrive doesn't offer batch archiving of emails through the UI, but you can archive them using the API with this tool.

Awesome Lists containing this project

README

          

# ✉️ Pipedrive email archiver

A Node.js tool to bulk archive emails in Pipedrive via their API, since the UI doesn't provide a batch archive feature.

image

## Features

- Fetches all email threads from your Pipedrive inbox or sent folder
- Bulk archives unarchived emails
- Support for archiving both inbox and sent emails
- Dry-run mode to preview what will be archived
- Interactive confirmation before archiving
- Progress tracking and statistics
- Colorful CLI output with clear status indicators

## Prerequisites

- Node.js 18+ installed
- Pipedrive account with API access
- API token from Pipedrive

## Installation

1. Clone or download this repository
2. Install dependencies:
```bash
npm install
```

3. Copy `.env.example` to `.env`:
```bash
cp .env.example .env
```

4. Edit `.env` and add your Pipedrive API token:
```ini
PIPEDRIVE_API_TOKEN=your_api_token_here
PIPEDRIVE_DOMAIN=yourcompany.pipedrive.com
```

To get your API token:
- Log in to Pipedrive
- Go to Settings → Personal preferences → API
- Copy your personal API token

## Usage

### Interactive mode (Default)
```bash
npm start
```
This will:
1. Fetch all email threads from your inbox
2. Show you a summary of archived/unarchived emails
3. Ask for confirmation before archiving
4. Archive all unarchived emails

### Archive sent emails
```bash
npm start -- --sent
```
Archives sent emails instead of inbox emails.

### Dry run mode
Preview what will be archived without making changes:
```bash
npm run dry-run
# or
npm start -- --dry-run
```

### Skip confirmation
Archive without the confirmation prompt:
```bash
npm start -- --yes
# or
npm start -- -y
```

### Combine options
You can combine different options:
```bash
# Dry run for sent emails
npm start -- --sent --dry-run

# Archive sent emails without confirmation
npm start -- --sent --yes
```

### Help
```bash
npm start -- --help
```

## How it works

The tool uses Pipedrive's Mail Threads API to:

1. Fetch all email threads from your inbox using pagination
2. Filter out already archived threads
3. Archive each unarchived thread individually
4. Provide real-time progress updates

## API endpoints used

- `GET /mailbox/mailThreads` - Fetch email threads
- `PUT /mailbox/mailThreads/{id}` - Archive individual threads

## Rate limiting

The tool includes a 100ms delay between archive operations to avoid hitting API rate limits.

## Troubleshooting

### "PIPEDRIVE_API_TOKEN not found"

Make sure you've created a `.env` file with your API token.

### "Failed to fetch email threads"

- Verify your API token is correct
- Check if your Pipedrive domain is set correctly in `.env`
- Ensure you have the necessary permissions in Pipedrive