← Developer guides

Slack Block Kit

Use rich-text blocks for structured messages. The batch keeps lists, quotations and code in their native Slack shapes wherever possible.

Installation guide · Examples tested with 0.3.1

Result

The first rich_text block contains a bold “Ship” followed by “ today”. Supply the Slack channel and send each part with its text fallback for notifications and screen readers.

Code examples

  • TypeScript
  • Python
  • Go

TypeScript

import { toMessages } from "mdto-messages";

const batch = toMessages("**Ship** today", "slack");
console.log(batch.messages);

Python

from mdto_messages import to_messages

batch = to_messages("**Ship** today", "slack")
print(batch.messages)

Go

package main

import (
    "fmt"
    "log"

    "github.com/jmeinke/mdto-messages"
)

func main() {
    batch, err := mdto.ToMessages("**Ship** today", mdto.Slack)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(batch.Messages)
}

Format a draft for the Slack composer

References

  • Original example and platform reference
  • API reference and limits

Source: mdto-messages 0.3.1 · MIT license