This Node.js script exports conversations from your Intercom workspace and saves them into JSON files, handling API rate limits and pagination effectively.
The script:
- Fetches conversations from Intercom's API
- Handles pagination and rate limits
- Saves conversations locally as structured JSON files
- Node.js (v16 or higher recommended)
- An active Intercom account
- Intercom API token with appropriate permissions
git clone <REPOSITORY_URL>
cd <REPOSITORY_DIRECTORY>npm installCreate a .env file at the root of your project and add your Intercom API token:
INTERCOM_TOKEN=your_intercom_api_tokenReplace your_intercom_api_token with your actual Intercom API token.
Execute the script with the following command:
npm startThe script will:
- Export batches of conversations
- Save each batch as
conversations_<timestamp>.jsonin your project directory
project-root/
├── conversations_<timestamp>.json
├── create_conversations.js
├── package.json
└── .env
- Ensure your API token has the necessary permissions.
- Adjust pagination parameters in
create_conversations.jsif needed. - Be mindful of Intercom's API rate limits.