@replyke/express
Version:
Replyke: Build interactive apps with social features like comments, votes, feeds, user lists, notifications, and more.
18 lines (17 loc) • 680 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const utility_functions_1 = require("./utility-functions");
exports.default = async (req, _, newNotificationData) => {
const notificationCreatedWebhook = req.project.webhooks.notificationCreated;
if (!notificationCreatedWebhook)
return;
const sharedSecret = req.project.keys.secret?.key;
if (!sharedSecret)
return;
try {
await (0, utility_functions_1.sendWebhookRequest)(notificationCreatedWebhook, newNotificationData, sharedSecret);
}
catch (err) {
console.error("Error sending notification webhook to project: " + req.project.id);
}
};