Registry / communication / node-iterable-api

node-iterable-api

JSON →
library1.2.0jsnpmunverified

node-iterable-api is a Node.js client library that provides a wrapper around the Iterable API, enabling developers to programmatically interact with various Iterable services such as managing user lists, tracking events, updating user profiles, triggering campaigns, and handling commerce data. The current stable version is 1.2.0. The package has seen irregular updates, including recent dependency and security fixes in v1.0.3, indicating active maintenance rather than a strict release cadence. A key differentiator is its direct mapping to the Iterable API documentation, though it's explicitly noted that not all Iterable API resources are fully implemented, requiring developers to check `lib/api.js` for current support. This library is primarily designed for CommonJS environments.

npm install node-iterable-api
INSTALL
IMPORT
SIG · NODE-ITERABLE-API
N
node-iterable-api
communicationjavascriptv1.2.0
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.

create
const client = require('node-iterable-api').create('<api-key>')
import { create } from 'node-iterable-api'
The primary way to instantiate the client is via CommonJS `require()` and accessing the `create` method. ESM `import` is not officially supported and may not work as expected due to the library's CommonJS design.
IterableClient
const IterableClient = require('node-iterable-api')
import IterableClient from 'node-iterable-api'
While you can import the entire module, the recommended pattern is to directly call `.create()` on the required module to get an instance of the client.

Initializes the Iterable API client and demonstrates fetching lists and updating a user profile.

const client = require('node-iterable-api').create(process.env.ITERABLE_API_KEY ?? ''); async function getIterableLists() { if (!process.env.ITERABLE_API_KEY) { console.warn('ITERABLE_API_KEY environment variable is not set. Using a dummy key. Operations will likely fail.'); } try { // Retrieve all lists available in your Iterable account const response = await client.lists.get(); console.log('Successfully retrieved Iterable lists:', response.lists); // Example: Create a new user (replace with actual user data) const userUpdateResponse = await client.users.update({ email: 'test@example.com', dataFields: { firstName: 'Test', lastName: 'User', registrationDate: new Date().toISOString() } }); console.log('User update response:', userUpdateResponse); } catch (err) { console.error('An error occurred:', err.message || err); if (err.body) { console.error('Error details:', err.body); } } } getIterableLists();
Debug
Known issues
gotchaNot all resources available in the Iterable API documentation are implemented in this library. Developers must check the `lib/api.js` file within the package to determine which API endpoints are currently supported before attempting to use them.
fix
Consult `lib/api.js` for implemented resources. If a needed resource is missing, consider contributing to the library or making direct HTTP calls to the Iterable API.
affects: >=0.1.0
gotchaThe library primarily uses a CommonJS `require()` pattern for instantiation. While Node.js supports ESM, attempting to use ES module `import` syntax might lead to undefined behavior or errors, as the package structure may not be fully optimized for ESM.
fix
Always use `const client = require('node-iterable-api').create('<api-key>')` for consistent and reliable operation within Node.js applications.
affects: >=0.1.0
gotchaThe package lists 'Known Vulnerabilities' via its Snyk badge. It's crucial to regularly run security audits (e.g., `npm audit`) to identify and mitigate any dependencies with reported vulnerabilities, especially in production environments.
fix
Regularly run `npm audit` and address reported vulnerabilities by updating dependencies or following Snyk's recommendations. Monitor the project's GitHub for security advisories.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: client.someNewResource.someAction is not a function
Attempting to call an Iterable API resource method that has not yet been implemented in the `node-iterable-api` wrapper.
fix
Verify the resource and action are listed in `lib/api.js` as implemented. If not, you will need to implement it yourself or use a direct HTTP request to the Iterable API.
Error: Iterable API Key is required
The `create` function was called without providing an API key argument.
fix
Ensure `client.create()` is called with your valid Iterable API key, typically stored as an environment variable: `client.create(process.env.ITERABLE_API_KEY)`.
(node:xyz) UnhandledPromiseRejectionWarning: Error: Bad Request (400) / Unauthorized (401) / Internal Server Error (500)
A request to the Iterable API failed due to an invalid request body, missing permissions, an incorrect API key, or a server-side error on Iterable's end.
fix
Check your API key for correctness, ensure the request payload matches Iterable's API documentation, and inspect the `err.body` or `err.message` in the catch block for specific error details from the Iterable API.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
30
OpenAI (training)
1
Resources
node-iterable-api — npm install node-iterable-api · libregistry