Skip to content

Instantly share code, notes, and snippets.

@robinglen
Last active September 2, 2022 12:31
Show Gist options
  • Save robinglen/8c5f392307d46f060a8f6122429d7ba1 to your computer and use it in GitHub Desktop.
Save robinglen/8c5f392307d46f060a8f6122429d7ba1 to your computer and use it in GitHub Desktop.
Format messages to send to Slack for Bookworms integration
import slackifyMarkdown from "slackify-markdown";
const headerForSlackMessage = () => {
return [
{
type: "header",
text: {
type: "plain_text",
text: "Bookmarks",
},
},
{
type: "divider",
},
];
};
const sendBookmarkCommands = () => {
return {
...headerForSlackMessage(),
{
type: "section",
text: {
type: "mrkdwn",
text: slackifyMarkdown(listOfBookmarksMarkDown())
},
}
]};
};
const sendBookMarks = (folder) => {
return {
blocks: [
...headerForSlackMessage(),
{
type: "section",
text: {
type: "mrkdwn",
text: slackifyMarkdown(getBookmarks(folder))
},
}]
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment