Registry / crm / node-marketo-rest-client-ng

node-marketo-rest-client-ng

JSON →
library1.0.4jsnpmunverified

A Node.js client library for interacting with the Marketo REST API. Version 1.0.4 targets Node >=14.17.6 and is a fork of the MadKudu/node-marketo library that adds support for lead.submitForm and debug logging for Marketo API responses. It provides methods for leads, campaigns, custom objects, and more, but lacks TypeScript types and comprehensive documentation. The package has not seen recent updates, but the underlying API is stable.

npm install node-marketo-rest-client-ng
INSTALL
IMPORT
SIG · NODE-MARKETO-REST-
N
node-marketo-rest-client-ng
crmjavascriptv1.0.4
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.

default
import Marketo from 'node-marketo-rest-client-ng'
const Marketo = require('node-marketo-rest-client-ng')
ESM import works; CommonJS require also works as package supports both.
Marketo
const Marketo = require('node-marketo-rest-client-ng')
CommonJS require returns the constructor function directly.
Marketo type
import type Marketo from 'node-marketo-rest-client-ng'
import { Marketo } from 'node-marketo-rest-client-ng'
No named type export; use default import for type if using ts.

Initializes a Marketo client using environment variables and fetches leads by IDs.

import Marketo from 'node-marketo-rest-client-ng'; const client = new Marketo({ endpoint: process.env.MARKETO_ENDPOINT ?? '', identity: process.env.MARKETO_IDENTITY ?? '', clientId: process.env.MARKETO_CLIENT_ID ?? '', clientSecret: process.env.MARKETO_CLIENT_SECRET ?? '' }); async function getLeads() { try { const leads = await client.lead.getLeads({ filterType: 'id', filterValues: '1,2,3' }); console.log('Leads:', leads); } catch (err) { console.error('Error:', err); } } getLeads();
Debug
Known issues
gotchaMarketo API authentication requires separate identity endpoint from REST endpoint.
fix
Ensure endpoint is REST endpoint (e.g., https://xxx.mktorest.com/rest) and identity is OAuth endpoint (https://xxx.mktorest.com/identity).
affects: >=1.0.0
gotchalead.submitForm method expects formId as number, not string.
fix
Pass formId as integer: await client.lead.submitForm({ formId: 1234, input: [...] });
affects: >=1.0.0
breakingThis fork changes constructor options compared to original MadKudu library.
fix
Check updated README for constructor parameters; original library used different property names.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: client.lead.getLeads is not a function
Client not properly initialized or method called before authentication.
fix
Ensure Marketo client is instantiated with valid credentials and await any initial auth step if needed.
Marketo API returns 401 Unauthorized
Invalid client ID or secret, or expired access token.
fix
Verify MARKETO_CLIENT_ID and MARKETO_CLIENT_SECRET environment variables and check token refresh logic.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
node-marketo-rest-client-ngrequiredself-package
Agent activity
25 hits · last 30 days
node
24
Resources
node-marketo-rest-client-ng — npm install node-marketo-rest-client-ng · libregistry