🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

marketo-simple-rest-api

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

marketo-simple-rest-api - npm Package Compare versions

Comparing version

to
0.1.3

42

index.js
/*
Author: Joe Choi <joechoi910@gmail.com>
Author: Joe Choi <joechoi910@gmail.com>
*/

@@ -59,3 +59,3 @@ 'use strict';

Example:
Example:
var options: {

@@ -65,3 +65,3 @@ 'process': 'add' || 'update' || 'remove',

'input': {
'email': 'user@email.com',
'email': 'user@email.com',
'firstName': 'John',

@@ -96,6 +96,6 @@ 'lastName': 'Doe',

Example:
Example:
var options: {
'email': 'user@email.com',
'campaign': 'campaignname from 'campaigns':{...} in init()',
'campaign': 'campaignname from 'campaigns':{...} in init()',
'tokens': [

@@ -132,3 +132,3 @@ {'name': '{{token1_name}}', 'value': 'some value'},

For add & update lead,
For add & update lead,
1) add or update lead

@@ -183,3 +183,3 @@ 2) add lead to list

if(response.success === true){
// 2) remove lead

@@ -190,3 +190,3 @@ var leadId = response.leadId;

if(response.success === true){
// 3) remove lead from list

@@ -236,3 +236,3 @@ if(listId !== '') {

if(response.success === true){
// 2) request campaign

@@ -316,6 +316,6 @@ var leadId = response.leadId;

var url = restEndpoint + 'rest/v1/lists/' + listId + '/leads.json?access_token=' + accessToken;
var data = {
var data = {
'input': [{
'id': leadId
}]
}]
};

@@ -344,6 +344,6 @@ request({

var url = restEndpoint + 'rest/v1/lists/' + listId + '/leads.json?access_token=' + accessToken + '&_method=DELETE';
var data = {
var data = {
'input': [{
'id': leadId
}]
}]
};

@@ -372,6 +372,6 @@ request({

var url = restEndpoint + 'rest/v1/leads.json?access_token=' + accessToken;
var data = {
'action': 'createOrUpdate',
var data = {
'action': 'createOrUpdate',
'lookupField': 'email',
'input': [options.input]
'input': [options.input]
};

@@ -390,3 +390,3 @@ data.input[0].email = options.email;

else{
callback({'success':false, 'error':'Marketo Add & Edit Lead API failed.'});
callback({'success':false, 'error':'Marketo Add & Edit Lead API failed with error: ' + JSON.stringify(error)});
}

@@ -402,6 +402,6 @@ });

var url = restEndpoint + 'rest/v1/leads.json?access_token=' + accessToken;
var data = {
var data = {
'input': [{
'id': leadId
}]
}]
};

@@ -430,3 +430,3 @@ request({

var url = restEndpoint + 'rest/v1/campaigns/' + campaignId + '/trigger.json?access_token=' + accessToken;
var data = {
var data = {
'input': {

@@ -436,3 +436,3 @@ 'leads': [{

}],
}
}
};

@@ -439,0 +439,0 @@ // add tokens if exists

{
"name": "marketo-simple-rest-api",
"version": "0.1.0",
"version": "0.1.3",
"description": "NodeJs interface for Marketo REST API. Syncs leads and sends email campaigns via Marketo platform.",

@@ -14,3 +14,3 @@ "main": "index.js",

"type": "git",
"url": "https://github.com/momotofu/marketo-rest-api"
"url": "https://github.com/momotofu/marketo-simple-rest-api"
},

@@ -17,0 +17,0 @@ "author": "Christopher Reece",

@@ -1,5 +0,5 @@

#marketo-rest-api
#marketo-simple-rest-api
=========
marketo-rest-api is a NodeJs interface for Marketo REST API @ http://developers.marketo.com/documentation/rest/. Syncs leads and sends email campaigns via Marketo platform.
marketo-simple-rest-api is a NodeJs interface for Marketo REST API @ http://developers.marketo.com/documentation/rest/. Syncs leads and sends email campaigns via Marketo platform.

@@ -9,3 +9,3 @@ ## Installation

```sh
$ npm install marketo-rest-api
$ npm install marketo-simple-rest-api
```

@@ -16,3 +16,3 @@

Marketo API's client id, client secret and rest endpoint are required.
Follow the instruction @ http://developers.marketo.com/blog/quick-start-guide-for-marketo-rest-api/ to sign up for Marketo Rest API.
Follow the instruction @ http://developers.marketo.com/blog/quick-start-guide-for-marketo-simple-rest-api/ to sign up for Marketo Rest API.

@@ -22,6 +22,6 @@ ## Usage

### init(options, callback);
Initialize marketo-rest-api with your Marketo confirgurations including campaigns and lists.
Initialize marketo-simple-rest-api with your Marketo confirgurations including campaigns and lists.
```js
var marketo = require('marketo-rest-api');
var marketo = require('marketo-simple-rest-api');
var options = {

@@ -48,3 +48,3 @@ 'clientId': 'xxxxx',

### syncLead(options, callback);
Sync leads on Marketo lead database and associates the lead to Marketo list.
Sync leads on Marketo lead database and associates the lead to Marketo list.

@@ -56,3 +56,3 @@ ```js

'input': {
'email': 'user@email.com',
'email': 'user@email.com',
'firstName': 'John',

@@ -79,3 +79,3 @@ 'lastName': 'Doe',

'email': 'user@email.com',
'campaign': 'campaignname from 'campaigns':{...} in init()',
'campaign': 'campaignname from 'campaigns':{...} in init()',
'tokens': [

@@ -94,3 +94,3 @@ {'name': '{{token1_name}}', 'value': 'some value'},

Before running test for the first time, provide Marketo API values in ./test/test.json.
Before running test for the first time, provide Marketo API values in ./test/test.json.

@@ -97,0 +97,0 @@ ```sh

@@ -18,3 +18,3 @@ /*

// start test
describe('marketo-rest-api', function() {
describe('marketo-simple-rest-api', function() {

@@ -28,6 +28,6 @@ // test init

done();
},
},
function(err) {
if (err) throw err;
done();
if (err) throw err;
done();
});

@@ -40,3 +40,3 @@ });

describe('marketo.syncLead(options, callback)', function() {
// test delete lead

@@ -53,6 +53,6 @@ var options = {

done();
},
},
function(err) {
if (err) throw err;
done();
if (err) throw err;
done();
});

@@ -66,3 +66,3 @@ });

'list': 'listname_1',
'email': 'johndoe3@johndoecompany.com',
'email': 'johndoe3@johndoecompany.com',
'input': {

@@ -81,6 +81,6 @@ 'firstName': 'John',

done();
},
},
function(err) {
if (err) throw err;
done();
if (err) throw err;
done();
});

@@ -94,3 +94,3 @@ });

'list': 'listname_1',
'email': 'johndoe3@johndoecompany.com',
'email': 'johndoe3@johndoecompany.com',
'input': {

@@ -109,6 +109,6 @@ 'firstName': 'John (updated)',

done();
},
},
function(err) {
if (err) throw err;
done();
if (err) throw err;
done();
});

@@ -123,3 +123,3 @@ });

var options = {
'email': 'johndoe3@johndoecompany.com',
'email': 'johndoe3@johndoecompany.com',
'campaign': 'campaignname_1'

@@ -132,6 +132,6 @@ };

done();
},
},
function(err) {
if (err) throw err;
done();
if (err) throw err;
done();
});

@@ -138,0 +138,0 @@ });