bookworms-slack-webhook
Version:
This is a simple module to add a route into your server and have slack updates.
18 lines (14 loc) • 420 B
JavaScript
import { sendBookMarks, sendBookmarkCommands } from "../integrations/slack.js";
const defaultRoute = "/webhooks/slack/bookworms";
const requestHandler = (body, res) => {
if (
body?.text === undefined ||
body?.text === "" ||
body?.text?.toLowerCase() === "all"
) {
res.send(sendBookmarkCommands());
} else {
res.send(sendBookMarks(body.text));
}
};
export { requestHandler, defaultRoute };