#slack #json #serde

slack-bk

Slack BlockKit API abstraction for Rust

2 releases

0.1.1 Sep 16, 2021
0.1.0 Mar 12, 2021

#36 in #slack

Download history 101/week @ 2024-07-19 177/week @ 2024-07-26 60/week @ 2024-08-02 188/week @ 2024-08-09 82/week @ 2024-08-16 58/week @ 2024-08-23 82/week @ 2024-08-30 59/week @ 2024-09-06 83/week @ 2024-09-13 107/week @ 2024-09-20 210/week @ 2024-09-27 80/week @ 2024-10-04 132/week @ 2024-10-11 27/week @ 2024-10-18 79/week @ 2024-10-25 117/week @ 2024-11-01

365 downloads per month
Used in rss-forwarder

MIT license

18KB
440 lines

slack-bk Build Status Docs Latest Version

Rust crate for Slack's BlockKit API

You'll probably want to reference Slack's documentation while using this crate.

Using slack-bk with an HTTP client

slack-bk does not come with a built in mechanism to talk to slack's API. There are many popular HTTP libraries in the rust ecosystem and the user is free to choose their own.

use reqwest::{Client, Error};
use slack_bk::surfaces::Message;

async fn send_to_webhook(webhook: &str, client: &Client, msg: Message) -> Result<(), Error> {
    client
        .post(webhook)
        .json(&msg)
        .send()
        .await?
        .error_for_status()?
        .map(|_| ())

}

Dependencies

~0.3–1MB
~21K SLoC