https://github.com/nsat/slack-bk
A rust crate for Slack's BlockKit API
https://github.com/nsat/slack-bk
rust serde slack
Last synced: about 2 months ago
JSON representation
A rust crate for Slack's BlockKit API
- Host: GitHub
- URL: https://github.com/nsat/slack-bk
- Owner: nsat
- License: mit
- Created: 2021-02-15T11:32:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-12T10:29:53.000Z (over 4 years ago)
- Last Synced: 2025-01-13T13:54:30.412Z (over 1 year ago)
- Topics: rust, serde, slack
- Language: Rust
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# slack-bk [![Build Status]][actions] [![Docs]][docs.rs] [![Latest Version]][crates.io]
[Build Status]: https://img.shields.io/github/workflow/status/nsat/slack-bk/Rust/master
[actions]: https://github.com/nsat/slack-bk/actions?query=branch%3Amaster
[Docs]: https://docs.rs/slack-bk/badge.svg
[docs.rs]: https://docs.rs/slack-bk/
[Latest Version]: https://img.shields.io/crates/v/slack-bk.svg
[crates.io]: https://crates.io/crates/slack-bk
Rust crate for Slack's BlockKit API
You'll probably want to reference [Slack's documentation](https://api.slack.com/block-kit) 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.
```rust
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(|_| ())
}
```