madkudu / node-marketo Goto Github PK
View Code? Open in Web Editor NEWREST Client for Marketo API
License: Apache License 2.0
REST Client for Marketo API
License: Apache License 2.0
Is there a Regex we can use reliably to match against a munchkin ID? It looks like they follow the format
AAA-AAA-AAA
...where "A" can be a letter or number. However is this something we can rely on?
We cant use the generic "string" type because it has input vulnerabilities with how we are allowing our customers to configure the ID.
Thanks.
currently i see there is no support for opportunity object in node-marketo node module. can you please provide support for opportunity object of marketo.
tried to use statustillcomplteted work flow and it not coming out the flow in the till completed case and giving the promise errors can you please help me on this.
Here is the error i am getting:
reason is {"requestId":"79bb#16494e58f06","errors":[{"code":"606"}]}
Possibly unhandled TypeError: Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.
at PromiseResolver$reject (F:\marketo\node_modules\node-marketo-rest\node_modules\bluebird\js\main\promise_resolver.js:118:15)
at tryCatch1 (F:\marketo\node_modules\node-marketo-rest\node_modules\bluebird\js\main\util.js:45:21)
at Promise$_callHandler [as _callHandler] (F:\marketo\node_modules\node-marketo-rest\node_modules\bluebird\js\main\promise.js:660:13)
at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (F:\marketo\node_modules\node-marketo-rest\node_modules\bluebird\js\main\promise.js:675:18)
at Promise$_settlePromiseAt [as _settlePromiseAt] (F:\marketo\node_modules\node-marketo-rest\node_modules\bluebird\js\main\promise.js:845:14)
at Promise$_settlePromises [as _settlePromises] (F:\marketo\node_modules\node-marketo-rest\node_modules\bluebird\js\main\promise.js:988:14)
at Promise$_rejectPromises [as _rejectPromises] (F:\marketo\node_modules\node-marketo-rest\node_modules\bluebird\js\main\promise.js:981:10)
at Async$_consumeFunctionBuffer [as _consumeFunctionBuffer] (F:\marketo\node_modules\node-marketo-rest\node_modules\bluebird\js\main\async.js:77:12)
at Async$consumeFunctionBuffer (F:\marketo\node_modules\node-marketo-rest\node_modules\bluebird\js\main\async.js:40:14)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
This is not happening all the time.
But it happens occasionally.
Not sure what is really causing this.
I'm not sure if it's related but I've checked the code and found out that "find" is actually implemented with POST. Any reason why it's implemented with POST?
It doesn't set content-type to application/json because the body is sent as form urlencoded I believe.
Greetings!
This is Yuan. I would like to take ownership of this repo. Would you mind transferring the ownership of this repo to me ?
Thanks,
Regards,
Yuan
Hello!
Your project seems cool and just what I need, but I couldn't find it on npm: https://www.npmjs.com/search?q=marketo
There are only other (SOAP) projects. As there are no special instructions on installation, this might be some error.
Also, what's the license? Without any, it's "all rights reserved", I believe.
Thank you for resolving this issue!
The lead.mergeLead endpoint accepts the url parameter but it does not get used in the final request resulting in an error from Marketo { code: '1003', message: 'Losing lead ids not specified' }
Hi, I'm following the examples, but I get an error about Missing WSDL. I don't see anything in the docs about how to set this. Any guidance on this?
Hi
I'd like to do bulk import leads to marketo.
The API link here : http://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Bulk_Leads/importLeadUsingPOST
Questions:
Thanks
More of a documentation issue.
I see that the repo has an example for using the bulkLeadExtract api, but i could not find an example using the bulk activity extract API.
I´m attempting to get it but I run up against undefined filter errorsl, and am unsure if I am missing other options that I would be able to use.
{createdAt: {
startAt: '2018-07-01T23:59:59-00:00',
endAt: '2018-07-03T23:59:59-00:00'
},
activityTypeIds: [
1,
12,
13
]})
.then(function(data) {
// export is ready
let exportId = data.result[0].exportId;
return marketo.bulkActivityExtract.file(exportId);
})
.then(function(file) {
console.log(file);
});
});
Error I get sometimes
Possibly unhandled HttpError. Invalid value specified for attribute 'filter'
node_modules/node-marketo-rest/lib/api/lead.js:98
leadIds: leadId.join(),
TypeError: leadId.join is not a function
I'm pretty certain the implementation of the stream is faulty.
It starts pushing data to the stream possibly before _read is called for the first time, which creates problem with asynchronous invocations.
Why is log.info
called when there's an authentication error ? It should throw an Error, I'm facing several issues because of this.
https://github.com/MadKudu/node-marketo/blob/master/lib/connection.js#L135
Btw, e[0]
is undefined (it logs "Unable to authenticate: undefined"
)
First of all, this module is great (:+1: to publish it on npm).
For a specific use case, I'd like to use the REST method associateLead. If I implement it myself, would you accept my pull request ? Just to be sure if I can use your module or if I better do my own.
Thanks in advance
Code:
createLead: function(listID,leadObj) {
marketo.lead.createOrUpdate(
[leadObj],
{lookupField: 'email'}
).then(function(data) {
console.log(data,data.result[0].reasons);
if (typeof(data.result[0].id) !== undefined)
{
console.log(listID,data.result[0].id);
marketo.list.addLeadsToList(listID, [data.result[0].id]).then(function(data){
console.log(data);
});
}
});
}
Output:
Possibly unhandled Error: [object Object]
at PromiseResolver$reject as reject
at /opt/pepperdata/node_modules/node-marketo-rest/lib/retry.js:73:17
at tryCatch1 (/opt/pepperdata/node_modules/node-marketo-rest/node_modules/bluebird/js/main/util.js:45:21)
at Promise$_callHandler as _callHandler
at Promise$_settlePromiseFromHandler as _settlePromiseFromHandler
at Promise$_settlePromiseAt as _settlePromiseAt
at Promise$_settlePromises as _settlePromises
at Promise$_rejectPromises as _rejectPromises
at Async$_consumeFunctionBuffer as _consumeFunctionBuffer
at Async$consumeFunctionBuffer (/opt/pepperdata/node_modules/node-marketo-rest/node_modules/bluebird/js/main/async.js:40:14)
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickDomainCallback (node.js:390:13)
There are a few automated PRs out to fix vulnerable packages. Can someone with write access merge those in?
It seems that whenever a promise doesn't not return results, Marketo.streamify
returns a stream that never ends.
e.g. the stream
Marketo.streamify(marketo.lead.getActivities([], activity_types_ids, nextPageToken))
does not seem to start/end whenever the response to marketo.lead.getActivities([], activity_types_ids, nextPageToken)
has no results.
right now am seeing webhook support for marketo api. is there any plan for implementing it in node-marketo.
I see a stream api,but am not sure is this a trigger or in bound api or is it something related to handling chunks of data
The GitHub repo's latest release is currently 0.3.0
while the NPM page is at 0.7.3
Looks like the current GitHub master is actually at 0.7.3
too, so maybe its just a matter of adding some Git tags? Would be a tad easier to follow along if they were added. Thanks!
Snyk is reporting an issue with the qs package that is bundled with this package via:
https://app.snyk.io/vuln/npm:qs:20170213
This packages uses restler, an unmaintained HTTP client that pins it's dependencies.
Line 22 in 94fa0bd
"dependencies": {
"qs": "1.2.0",
"xml2js": "0.4.0",
"yaml": "0.2.3",
"iconv-lite": "0.2.11"
},
I would suggest moving to an actively maintained package like node-fetch or request.
Awesome work on this Marketo REST client!
I'm hoping you can point me in the right direction so I can download the bulk lead extract file once complete. How can I return the file once the export is ready?
marketo.bulkLeadExtract.get(
['firstName', 'lastName', 'id', 'email'],
{ staticListName: 'g_test_export' })
.then(function(data) {
// export is ready
let exportId = data.result[0].exportId;
return marketo.bulkLeadExtract.file(exportId);
})
.then(function(file) {
res.download(file);
}).catch(next);
});
Forms are not included in the package or did I miss something?
Currently, node-marketo supports the leads/describe.json endpoint. Marketo has introduced the leads/describe2.json endpoint. According to their developer relations team, developers are encouraged to use describe2 instead of describe, at least because:
node-marketo should support describe2 as well as describe. It's an easy change, so I'll submit a PR myself.
https://www.npmjs.com/package/node-marketo is empty and waiting.
I was trying to import leads from marketo using streams (it was almost 200K data). After importing (~100K) I got consistent error
code was something like
```
// Only pass to Marketo API a subset of the options passed to this function.
var opts = {
listId: options.listId,
batchSize: options.batchSize || 300,
fields: options.fields
};
// Return a stream.
return client.list.getLeads(options.listId, opts).then(function(res){
return M.streamify(Promise.resolve(res));
});
```
Error is:
{"requestId":"1751d#1570622065b","success":false,"errors":[{"code":"605","message":"Request method 'POST' not supported"}],"level":"error","message":"","timestamp":"2016-09-07T19:31:16.033Z"}
as far as I understand stream is stopped after error happens and there is no way to get the remains data. Is there any way to resume the stream to get remain leads from marketo.
@yuanzhaoYZ has been working on this. Will do a PR when tested.
push: function(input, options) {
if (!.isArray(input) && !.isEmpty(input)) {
var msg = 'input must be an array of leads';
log.error(msg);
return Promise.reject(msg);
}
var data = _.extend({}, options, {
input: input
});
var path = util.createPath('leads', 'push.json');
return this._connection.postJson(path, data)
.then(function(data) {
if (data.success) {
return data;
} else {
log.warn('Cannot push lead: ', data);
return Promise.reject('Cannot get lead(s) from input: ' + JSON.stringify(input));
}
});
},
Implements Push Leads
param | type | description |
---|---|---|
input |
Array | An array of lead records to push |
options |
object | |
lookupField : the field used to dedup on |
||
programName : the program name in Marketo |
// Push a lead to Marketo program name
marketo.lead.push(
[{'email': '[email protected]'}, {'email': '[email protected]'}],
{lookupField: 'email', programName: 'Test program name'}
)
webpack not able to build because of node-marketo-rest
internal code when smartlist
api being used.
ERROR in ./node_modules/node-marketo-rest/lib/marketo.js
Module not found: Error: Can't resolve './api/smartlist' in .../marketo-list/node_modules/node-marketo-rest/lib'
@ ./node_modules/node-marketo-rest/lib/marketo.js 11:16-42
@ ./node_modules/node-marketo-rest/index.js
@ ./index.ts
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.