2 unstable releases

0.1.0 Dec 13, 2019
0.0.1 Dec 13, 2019

#15 in #kit

Download history 210/week @ 2023-12-18 45/week @ 2023-12-25 208/week @ 2024-01-01 10/week @ 2024-01-22 20/week @ 2024-02-19 17/week @ 2024-02-26 8/week @ 2024-03-04 33/week @ 2024-03-11 21/week @ 2024-03-18 19/week @ 2024-03-25 38/week @ 2024-04-01

112 downloads per month


2.5K SLoC


Actions Status crate-name at crates.io

Simple wrapper for Slack API, Block Kit and Payloads for Slach Commands and Interactive Components. Implemented using serde


other samples


1. load env

// export SLACK_BOT_TOKEN=xoxb-your-bot-token
// export SLACK_CHANNEL=random
let config = match from_env::<SlackConfig>() {
     Ok(val) => val,
     Err(err) => {
         error!("{}", err);

2. setup block payload

let section = SectionBlock::new(Markdown("@here *Hello World*, `section1`".into()));
let common_payload = CommonMessagePayload::new().blocks(vec![section.into()]);
let payload = ChatPostMessagePayload::new(&config.channel, common_payload);

3. POST.

Sample with reqwest

let res: PostMessageResponse = reqwest::Client::new()
    .header("Authorization", format!("Bearer {}", config.bot_token))

Block Kit

  • Block Kit is a UI framework for Slack apps that offers a balance of control and flexibility when building experiences in messages and other surfaces.

  • Customize the order and appearance of information and guide users through your app's capabilities by composing, updating, sequencing, and stacking blocks — reusable components that work almost everywhere in Slack.

Quoted from official docs

Structure Overview

App Surface is anywhere an app can express itself throught communication or interaction. It may have some Blocks.

Block is a visual component. Blocks can be stacked and arranged to create layouts. The essential Block Kit building experience is the same in any surfaces.

Block may have some Block Elements and some Composition Objects. The number of elements it can have depends on the type of block. For example,

[Block Elements]

  • Section: up to 1.
  • Divider: cannot have.
  • Actions: up to 5.

[Composition Objects]

  • Section: some Texts in text and fields.
  • Divider: cannot have.

Block Element is a visual smaller component. Elements can be used inside of section, context, actioons block. They constitutes a part of Block. Element may have some Composition Objects.

Composition Object is also a visual component, but is smaller than Block Element. It can be used inside of blocks and block elements. And, it may have some Composition Objects.

For example,

  • Confirmation dialog: some Text object.
  • Option: 1 Text object.
  • Option group: 1 Text object and some option objects up to 100.

Some sentences are referred by official docs

Supported Surfaces

  • Messages
  • Home tab
  • Modals

view payloads, Home Tab and Modals, haven't been supported yet, but will be soon.

Supported Blocks

  • Section
  • Context
  • Actions
  • Divider
  • Image
  • File
  • Input

Supported Block Elements

  • Button
  • Date Picker
  • Image
  • Multi-select Menu
  • Overflow Menu
  • Plain-text Input
  • Radio button group
  • Select Menus

Supported Composition Objects

  • Text
  • Confirmation dialog
  • Option
  • Option group

static linking

As described in rust-musl-builder.

alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder'
rust-musl-builder cargo build --example interactive_server --release


~25K SLoC