require('config'); var iftttKey = config.IFTTT.key; var requestToken = config.IFTTT.request_token; exports.callIFTTTWebhook = (req, res) => { if (req.body.secret != requestToken) return; var triggers = req.body.triggers; for( var i in triggers) { var url = 'https://maker.ifttt.com/trigger/' + triggers[i] + '/with/key/' + iftttKey; var options = { url: url, method: 'POST', headers: { 'Content-Type':'application/json' } }; request(options, callback); } function callback(error, response, body) { if (error == true) { console.log(body); } } // send status res.status(200).send('ok'); };