slack-blocks
v1.2.0
Published
slack block utility
Downloads
6
Readme
@tomsd/slack-blocks
Installation
npm install slack-blocks
Usage
import * as SlackThings from "slack-blocks";
const blocks = SlackThings.SlackBlocks.create();
const blocks_array = blocks
.addMarkdown("this is a *mrkdwn* text")
.addText("this is a plain text")
.addImage("https://some.dom/image.png")
.addSection("text", SlackThings.SlackImage.create("https://some.dom/image.png"))
.toObject();
console.log(blocks_array);
// blocks_array
[
{
type: "mrkdwn",
text: "this is a *mrkdwn* text"
},
{
type: "plain_text",
text: "this is a plain text",
emoji: true
},
{
type: "image",
image_url: "https://some.dom/image.png",
alt_text: "image"
},
{
type: "section",
text: {
type: "mrkdwn",
text: "text"
},
accessory: {
type: "image",
image_url: "https://some.dom/image.png",
alt_text: "image"
}
}
]