Registry / communication / intercom-client

intercom-client

JSON →
library7.0.3jsnpmunverified

The `intercom-client` package provides the official Node.js and TypeScript bindings for interacting with the Intercom API. It is currently stable at version `7.0.3` and supports Intercom API v2.14 as of its v7.0.0 release. The library maintains a frequent release cadence, often driven by automatic code generation via Fern, ensuring it stays up-to-date with the latest Intercom API specifications. Key features include comprehensive TypeScript type definitions for request and response payloads, built-in support for paginated list endpoints through iterators, automatic request retries with exponential backoff for transient errors, and configurable request timeouts. It is designed for modern Node.js environments, requiring Node.js 18 or newer, and embraces ESM imports.

npm install intercom-client
INSTALL
IMPORT
SIG · INTERCOM-CLIENT
I
intercom-client
communicationjavascriptv7.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

IntercomClient
import { IntercomClient } from 'intercom-client';
const IntercomClient = require('intercom-client').IntercomClient;
Use named import for the main client class. CommonJS `require` is not officially supported and may lead to issues.
Intercom
import { Intercom } from 'intercom-client';
import * as Intercom from 'intercom-client';
Import the `Intercom` namespace for accessing all exported request and response TypeScript types, e.g., `Intercom.User` or `Intercom.Article`.
IntercomError
import { IntercomError } from 'intercom-client';
import { Error } from 'intercom-client';
Import `IntercomError` to properly catch and handle API-specific errors, which are instances of this class or its subclasses.

Initializes the Intercom client using an environment variable for the API token and demonstrates how to make an API call (e.g., importing AI content) with robust error handling using `IntercomError`.

import { IntercomClient, IntercomError } from "intercom-client"; // Initialize the Intercom client with an API token from environment variables. // It's crucial to protect your Intercom API token and avoid hardcoding it. const INTERCOM_ACCESS_TOKEN = process.env.INTERCOM_ACCESS_TOKEN ?? ''; if (!INTERCOM_ACCESS_TOKEN) { console.error("Error: INTERCOM_ACCESS_TOKEN environment variable is not set."); process.exit(1); } const client = new IntercomClient({ token: INTERCOM_ACCESS_TOKEN }); async function importContent() { try { // Example: Create a content import source for AI capabilities. // Replace with the actual endpoint and parameters you intend to use. const result = await client.aiContent.createContentImportSource({ url: "https://www.example.com/your-business-faq-page", // Additional parameters might be required depending on the specific API call. // Refer to the Intercom API documentation for required fields. }); console.log("Content import initiated successfully:", result); } catch (err) { if (err instanceof IntercomError) { console.error(`Intercom API Error [${err.statusCode}]: ${err.message}`); console.error("Error Body:", err.body); console.error("Raw Response:", err.rawResponse); } else { console.error("An unexpected error occurred:", err); } } } importContent();
Debug
Known issues
breakingVersion `7.0.0` of `intercom-client` introduced support for Intercom API v2.14. This major version bump likely includes breaking changes to the API surface, endpoint paths, or data structures. Users migrating from `v6.x` or earlier should consult the official Intercom API documentation and the client's reference for specific changes relevant to their utilized endpoints.
fix
Review your API calls against the Intercom API v2.14 documentation and update code to match new endpoint signatures, request bodies, and response structures.
affects: >=7.0.0
gotchaThe library explicitly targets modern Node.js environments (`>=18.0.0`) and is written in TypeScript, preferring ES Module (ESM) import syntax. While CommonJS `require()` might partially function, using `import` statements is the recommended and best-supported approach, especially for type safety and future compatibility.
fix
Ensure your project is configured for ESM (`"type": "module"` in `package.json`) and use `import` syntax for all package imports.
affects: >=1.0.0
gotchaAPI errors (non-2xx HTTP responses) are encapsulated within `IntercomError` instances. Direct checks of `response.status` might not be necessary if you catch `IntercomError` to access `statusCode`, `message`, `body`, and `rawResponse` for comprehensive error handling.
fix
Wrap API calls in `try...catch` blocks and check if the caught error is an `instanceof IntercomError` to access detailed API error information.
affects: >=1.0.0
gotchaPagination for list endpoints has specific patterns, either using `for await...of` iterators or manual `hasNextPage()` and `getNextPage()` methods on the returned `PageableResponse` object. Attempting to directly destructure a paginated response like a simple array will not work for fetching subsequent pages.
fix
Utilize the provided iteration patterns (`for await...of` or `page.hasNextPage()/getNextPage()`) to correctly traverse paginated results, as demonstrated in the library's usage examples.
affects: >=1.0.0
Errors
Common errors & fixes
Error: INTERCOM_ACCESS_TOKEN environment variable is not set.
The Intercom client was initialized without an API token, or the environment variable was missing.
fix
Set the `INTERCOM_ACCESS_TOKEN` environment variable with your actual Intercom API token or pass `{ token: 'YOUR_TOKEN' }` directly to the `IntercomClient` constructor. For production, environment variables are recommended.
Intercom API Error [401]: Unauthorized
The provided Intercom API token is invalid, expired, or lacks the necessary permissions for the requested action.
fix
Verify that your `INTERCOM_ACCESS_TOKEN` is correct and active in your Intercom workspace. Check if the token has the required scopes/permissions for the API endpoint you are calling.
Intercom API Error [404]: Not Found
The requested resource (e.g., user, conversation, article by ID) does not exist, or the endpoint path is incorrect.
fix
Double-check the IDs or parameters used in your API call. Review the Intercom API documentation to confirm the correct endpoint path and resource existence.
Intercom API Error [429]: Too Many Requests
You have exceeded Intercom's API rate limits for your workspace.
fix
The library has built-in retries, but for sustained high load, implement client-side rate limiting or back-off strategies in your application. Review Intercom's rate limit documentation.
Upgrade
Version history
7.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
1
Resources
intercom-client — npm install intercom-client · libregistry