Last active
August 29, 2015 14:03
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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