Skip to content

Instantly share code, notes, and snippets.

@bdcorps
Last active November 16, 2021 00:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bdcorps/e668568e36dabd82f42dde9e5fa2f31e to your computer and use it in GitHub Desktop.
Trigger Zapier Webhook from Node.js
// using axios
const axios = require('axios');
export const notifyWebhook = async (url, body) => {
const res = await axios
.post(url, body, {
Accept: "application/json",
"Content-Type": "application/json"
})
}
// using fetch
export const notifyWebhook = async (url, body) => {
const res = await fetch(url, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({ body }),
});
console.log(res.json())
};
// notifyWebhook("https://hooks.zapier.com/hooks/catch/9939273/bds3d2n", {user: "saasbase"});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment