Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendSlackMessage: no more than 50 blocks #589

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/sendSlackMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,21 @@ export default async function sendSlackMessage ({
const { markdownToBlocks } = await import('@tryfabric/mack')

const web = new WebClient(token)
const blocks = await markdownToBlocks(message)
let blocks = await markdownToBlocks(message)

if (debug) { console.log(blocks) }

if (blocks.length > 50) {
blocks = blocks.slice(0, 49)
blocks.push({
type: 'section',
text: {
type: 'mrkdwn',
text: '...and more'
}
})
}

const result = await web.chat.postMessage({
username,
text: `${username} alert`,
Expand Down