bookworms-slack-webhook
Version:
This is a simple module to add a route into your server and have slack updates.
50 lines (45 loc) • 948 B
JavaScript
import slackifyMarkdown from "slackify-markdown";
import { getBookmarks, listOfBookmarksMarkDown } from "./bookworms.js";
const headerForSlackMessage = (title) => {
return [
{
type: "header",
text: {
type: "plain_text",
text: title,
},
},
{
type: "divider",
},
];
};
const sendBookmarkCommands = () => {
return {
blocks: [
...headerForSlackMessage("Bookmarks"),
{
type: "section",
text: {
type: "mrkdwn",
text: slackifyMarkdown(listOfBookmarksMarkDown()),
},
},
],
};
};
const sendBookMarks = (text) => {
return {
blocks: [
...headerForSlackMessage("Bookmarks"),
{
type: "section",
text: {
type: "mrkdwn",
text: slackifyMarkdown(getBookmarks(text)),
},
},
],
};
};
export { sendBookMarks, sendBookmarkCommands, headerForSlackMessage };