Skip to content

cloud303-cholden/rs-slack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

use slack::{
    Client,
    api::{
        Chat,
        input,
    },
};

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

    // API clients and inputs can be created and reused.
    let chat = client.api::<Chat>();
    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::<Chat>()
        .post_message(input::PostMessage {
            channel: "C0000000000",
            text: "Test",
            thread_ts: None,
        }).await?
    Ok(())
}

About

Simple Slack SDK for Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages