Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

Add a push method to push lead in marketo #46

@crabaux

Description

@crabaux
  • 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'}
  )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions