# flawless-slack
Transport protocol agnostic Slack client for Rust.
### Motivation
Rust code can run in many places, from tiny embedded systems, all they way to the browser.
Those environments are very different from each other. Some require you to roll your own
TCP implementation, others don't even give you access to low-level primitives like TCP.
`flawless-slack` is an attempt to build a Slack client that works equally well
"everywhere". It was born out of a need for a Slack client inside the [flawless] durable
execution engine. The engine runs Rust compiled to WebAssembly and doesn't provide raw
access to TCP streams, nor access to non-blocking `syscalls` that an `async` executor
could use. This disqualifies most other Slack client libraries out there.
By default, `flawless-slack` will use [`reqwest::blocking`] as a transport layer on
systems that are not WebAssembly. When compiling to `wasm32-unknown-unknown` it will use
the `flawless` implementation. However, all default transport layers can be disabled and
directly provided by you, in case you want to use it in a custom environment.
### Quick start
The Slack client takes 2 arguments, a secret token and an HTTP client implementation. If
you would like to use the client inside flawless, you can use the provided
`FlawlessHttpClient`:
```rust,ignore
use flawless_slack::{http_client::flawless_http_client::FlawlessHttpClient, SlackClient};
let secret_token = "".to_owned();
let slack_client = SlackClient::new(secret_token, FlawlessHttpClient {});
slack_client.send_message("#general","Hello World!").ok();
```
[flawless]: https://flawless.dev
[`reqwest::blocking`]: https://docs.rs/reqwest/latest/reqwest/blocking/index.html