This project aims to create a simple, idiomatic, fully documented Rust library for the Slack Web API. I gave a talk about it, titled "What's so hard about writing a Slack Client in Rust?" [Video] [Slides].
All code and error handling for the Slack methods are fully auto-generated.
What is missing is generating proper request and response types from the API.
This would be a lot of manual work at the moment, because the Slack API
documentation is not machine-readable. There is an open ticket for that and some
possible workarounds, but not much traction.
Because of that I need to halt this project for the near future.
I'm uploading it anyway to inspire fellow Rustaceans.
Update: There is an OpenAPI-based machine-readable spec available now. See here. Maybe someone wants to give it a shot.
- Great ergonomics. Easy to use.
- Pure, idiomatic Rust code.
- Fully documented and tested.
- Solid error handling.
- Proper conversion from JSON to semantic types.
- Full Slack API implementation.
let mut client = slack::Client::new("your_slack_token");
let response = client.im_history("D0AA48KM3").latest(123.1).send();
Alternatively you can build the request objects yourself:
let client = slack::Client::new("your_slack_token");
let history = history::HistoryOptions {
channel: "hello",
inclusive: Some(true),
..Default::default()
};
println!("{}", client.send(history).unwrap());
- Auto-generate Slack request and response types
- Enforce documentation (
#![deny(missing_docs)]
)