Registry / crm / node-marketo-rest

node-marketo-rest

JSON →
library0.12.2jsnpmunverified

A Node.js wrapper around Marketo's REST API with support for leads, lists, bulk extract, and streaming. Version 0.12.2, stable and unmaintained since 2022. Offers promise-based pagination helpers and streamify functions, unlike simpler request-only clients. Requires Node >=14.17.6 for Corepack compatibility.

npm install node-marketo-rest
INSTALL
IMPORT
SIG · NODE-MARKETO-REST
N
node-marketo-rest
crmjavascriptv0.12.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

Marketo
import Marketo from 'node-marketo-rest'
const Marketo = require('node-marketo-rest')
CommonJS require works in Node, ESM import may not be supported natively (package has no 'type': 'module'). Use require or transpile.
Marketo (raw require)
const Marketo = require('node-marketo-rest')
const marketo = require('node-marketo-rest').default
The package exports a single constructor function directly via module.exports.
streamify method
marketo.streamify('lead', 'getLeads', [1])
Marketo.streamify('lead', 'getLeads', [1])
streamify is an instance method, not static. Must be called on a Marketo instance.

Creates a Marketo client using environment variables for OAuth credentials and fetches leads by ID.

const Marketo = require('node-marketo-rest'); const marketo = new Marketo({ endpoint: process.env.MARKETO_ENDPOINT ?? '', identity: process.env.MARKETO_IDENTITY ?? '', clientId: process.env.MARKETO_CLIENT_ID ?? '', clientSecret: process.env.MARKETO_CLIENT_SECRET ?? '', }); marketo.lead.find('id', [2, 3]) .then(data => { console.log('Leads found:', data.result.length); }) .catch(err => { console.error('Error:', err); });
Debug
Known issues
breakingNode version <14.17.6 causes errors due to use of optional chaining and other ES2020 features.
fix
Update Node to >=14.17.6 or use an older version of the library.
affects: <0.12.2
deprecatedThe package has not been updated since 2022 and may not be compatible with future Marketo API changes.
fix
Consider migrating to a maintained alternative such as @marketo/marketo-rest-client.
affects: >=0.12.2
gotchaPagination methods like nextPage are only available when nextPageToken exists; calling them otherwise throws an error.
fix
Always check data.nextPageToken before calling data.nextPage().
affects: >=0.12.0
Errors
Common errors & fixes
TypeError: marketo.lead.find is not a function
Marketo instance created without proper initialization or clientId/clientSecret invalid causing internal load failure.
fix
Ensure OAuth credentials are correct and that you're using a valid Marketo instance: const marketo = new Marketo({...}) with all four fields.
Error: Cannot find module 'node-marketo-rest'
Package not installed or wrong import path.
fix
Run npm install node-marketo-rest and ensure it's in node_modules.
TypeError: data.nextPage is not a function
Calling nextPage() when data.nextPageToken is undefined (no more pages).
fix
Only call data.nextPage() if data.nextPageToken exists. Example: if (data.nextPageToken) { return data.nextPage(); }
Upgrade
Version history
0.12.2latest on npm
Audit
Dependencies
node-fetchrequiredUsed for HTTP requests to Marketo API
qsrequiredStringify query parameters
Agent activity
27 hits · last 30 days
node
24
Resources
node-marketo-rest — npm install node-marketo-rest · libregistry