Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a push method to push lead in marketo #46

Open
crabaux opened this issue Nov 17, 2017 · 0 comments
Open

Add a push method to push lead in marketo #46

crabaux opened this issue Nov 17, 2017 · 0 comments

Comments

@crabaux
Copy link
Contributor

crabaux commented Nov 17, 2017

  • Add push method in lead.js

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));
    }
  });

},

  • Add documentation in the API doc API.md

lead.push(input, options)

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'}
  )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant