wecom-agent

Crates.iowecom-agent
lib.rswecom-agent
version0.1.16
sourcesrc
created_at2024-02-18 03:58:57.659113
updated_at2024-03-20 15:34:07.079037
description企业微信API的轻封装,让消息发送更加便捷。
homepage
repositoryhttps://github.com/wandering-ai/wecom-agent
max_upload_size
id1143759
size19,953
Yin Guobing (yinguobing)

documentation

README

wecom-agent

wecom-agent是对企业微信API调用的轻封装,简化了各类信息的发送过程。

使用方法

use wecom_agent::{
    message::{MessageBuilder, Text},
    MsgSendResponse, WecomAgent,
};

async fn example() {
    let content = Text::new("Hello from Wandering AI!".to_string());
    let msg = MessageBuilder::default()
        .to_users(vec!["robin", "tom"])
        .from_agent(42)
        .build(content)
        .expect("Massage should be built");
    let handle = tokio::spawn(async move {
        let wecom_agent = WecomAgent::new("your_corpid", "your_secret")
            .await
            .expect("wecom agent should be initialized.");
        let response = wecom_agent.send(msg).await;
    });
}
Commit count: 22

cargo fmt