Trigger Zapier Webhook from Node.js
This file contains 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
// 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