slack-blocks
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

@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"
    }
  }
]

Readme

Keywords

Package Sidebar

Install

npm i slack-blocks

Weekly Downloads

1

Version

1.2.0

License

MIT

Unpacked Size

30.6 kB

Total Files

7

Last publish

Collaborators

  • tomsd