NGNC Bridge
Search
K
Comment on page

Webhook Implementation

Below is the webhook implementation code for Javascript or Node.Js
// Webhook Node.Js Implementaion
const secret = process.env.BRIDGE_WEBHOOK_SK;
function verifyWebhook(req, res, next) {
if (req.headers["bridge-webhook-secret"] !== secret) {
console.log("Unauthorized request.");
return res.status(401).json({
message: "Unauthorized request.",
});
}
next();
}
app.post("/webhook", verifyWebhook, (req, res) => {
const webhook = req.body;
console.log(webhook);
return res.sendStatus(200);
});
Last modified 3d ago