Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cloud303-cholden/rs-slack

Simple Slack SDK for Rust.
https://github.com/cloud303-cholden/rs-slack

Last synced: 1 day ago
JSON representation

Simple Slack SDK for Rust.

Awesome Lists containing this project

README

        

## Slack SDK
An unofficial Slack SDK for Rust. This library is not affiliated with Slack. It is for personal use and experimentation. Use at your own risk.

## Example
```rust
use slack::{
Client,
api::{
Chat,
input,
},
};

#[tokio::main]
async fn main() -> Result<(), Box> {
let client = Client::new("xoxb-000000000000-0000000000-000000000000000000000000");

// API clients and inputs can be created and reused.
let chat = client.api::();
let post_message = input::PostMessage {
channel: "C0000000000",
text: "Test",
thread_ts: None,
};
// Inputs can be passed by value and by reference.
chat.post_message(&post_message).await?;
chat.post_message(post_message).await?;

// Alternatively, make the entire request in a single statement.
client
.api::()
.post_message(input::PostMessage {
channel: "C0000000000",
text: "Test",
thread_ts: None,
}).await?
Ok(())
}
```