sarufi

Crates.iosarufi
lib.rssarufi
version0.1.1
sourcesrc
created_at2023-05-12 15:13:22.606761
updated_at2023-05-12 15:43:30.868399
descriptionA rust implementation for the sarufi API
homepage
repository
max_upload_size
id863072
size32,708
(Bulalu)

documentation

README

sarufi-rs 🦀

A rust package to help you interact with the Sarufi platform inspired by Python Sarufi SDK

Installation

cargo add sarufi

Authentication

>>> use sarufi::{Sarufi, ApiError}
>>> let api_key = std::env::var("YOUR_SARUFI_API_KEY")
>>> let api = Sarufi(api_key).unwrap()

Creating a bot


async fn test() -> Result<(),ApiError> {

    let name = "My Rusty Chatbot";
    let description = Some("A rusty chatbot created using Sarufi API");
    let industry = Some("Technology");
    let flow: Option<HashMap<String, Value>> = None;
    let intents: Option<HashMap<String, Vec<String>>> = None;
    let webhook_url = Some("https://example.com/webhook");
    let webhook_trigger_intents: Option<Vec<String>> = None;
    let visible_on_community = Some(true);  

    let bot = api.create_bot(
            name,
            description,
            industry,
            flow,
            intents,
            webhook_url,
            webhook_trigger_intents,
            visible_on_community,
    ).await?;

    println!("{:?}", bot);

    Ok(())
    
}

Check out the file test.rs for more examples

Commit count: 0

cargo fmt