Skip to content

Instantly share code, notes, and snippets.

@alexdong
Last active August 29, 2015 14:03
Show Gist options
  • Save alexdong/b3a11edf7e97fcf0562e to your computer and use it in GitHub Desktop.
Save alexdong/b3a11edf7e97fcf0562e to your computer and use it in GitHub Desktop.
Takes a new lead webhook from FLG 360 and create a new event in choir.io
/*
To use this script, replace the {{YOUR_TORPIO_KEY}} with your torpio.io API key
and replace {{{{YOUR_CHOIR_IO_KEY}} with your choir.io key when you create an API source.
*/
var settings = {};
settings.API_KEY = '{{YOUR_TORPIO_KEY}}';
if (request.body.status && request.body.status.indexOf('Junk Lead' === -1)) {
var data = {
label: 'FLG360:new_lead',
sound: 'g/3',
text: 'New lead from ' + request.body.fullname + ': ' +
request.body.data1 + ' (id: )' + request.body.id;
};
http.post({
url: 'https://api.choir.io/{{YOUR_CHOIR_IO_KEY}}',
json: data
},
function(error, status, body) {
if (error) {
log.error(error);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment