2 releases

0.1.1 Sep 16, 2021
0.1.0 Mar 12, 2021

#25 in #slack

Download history 31/week @ 2024-04-07 81/week @ 2024-04-14 95/week @ 2024-04-21 22/week @ 2024-04-28 33/week @ 2024-05-05 27/week @ 2024-05-12 31/week @ 2024-05-19 23/week @ 2024-05-26 64/week @ 2024-06-02 32/week @ 2024-06-09 66/week @ 2024-06-16 177/week @ 2024-06-23 88/week @ 2024-06-30 76/week @ 2024-07-07 72/week @ 2024-07-14 122/week @ 2024-07-21

358 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.4–1MB
~24K SLoC