Last active
September 2, 2022 12:31
-
-
Save robinglen/8c5f392307d46f060a8f6122429d7ba1 to your computer and use it in GitHub Desktop.
Format messages to send to Slack for Bookworms integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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