Skip to content

Instantly share code, notes, and snippets.

@banzeh
Created November 9, 2018 20:43
Show Gist options
  • Save banzeh/3927d3e928804293275cd2b79522f1ff to your computer and use it in GitHub Desktop.
Save banzeh/3927d3e928804293275cd2b79522f1ff to your computer and use it in GitHub Desktop.
HTTP Post on MongoDB Stitch - IFTTT Example
exports = async function(args){
console.log({args: args});
const api_url = "https://maker.ifttt.com";
const request_path = "/trigger/{webhook_event}/with/key/{your_ifttt_private_key}";
const ifttt = context.services.get("your-service-name");
const response = await ifttt.post({
url: api_url + request_path,
encodeBodyAsJSON: true,
body: {
"value1": args.value1,
"value2": args.value2,
"value3": args.value3
}
});
return EJSON.parse(response.body.text());
}
exports = function(payload, response){
// Your Code Here
const postArgs = {
"value1": "Hello",
"value2": "World",
"value3": "IFTTT :D"
};
context.functions.execute("{your-function-name}", postArgs); // Call the function and be happy :D
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment