#send-message #chat #rocket #hook #text #client #rocket-chat

rocketchat-message

Library to send rocket chat messages

4 releases

0.1.3 Jun 28, 2022
0.1.2 Jun 28, 2022
0.1.1 Jun 28, 2022
0.1.0 Jun 28, 2022

#65 in #send-message

MIT license

14KB
172 lines

RocketChat Message for Rust

This library is an implementation of rocket chat hooks for messages

Send text example

let client = RocketChat::new("ROCKET_CHAT_WEBHOOK_URL", "#channel");

client.send_text("Text").await?;

Send message example

let client = RocketChat::new("ROCKET_CHAT_WEBHOOK_URL", "#channel");

let msg = RocketChatMessage::new()
    .set_text("Text")
    .set_attachments(vec![RocketChatAttachment::new()
        .set_title("Attachment title")
        .set_title_link("https://google.fr")
        .set_text("Attachment text")
        .set_author_name("Author name")
        .set_color("#c97149")]);

client.send_message(msg).await?;

Send messages example

let client = RocketChat::new("ROCKET_CHAT_WEBHOOK_URL", "#channel");

let msgs = vec![
    RocketChatMessage::new().set_text("Message1"),
    RocketChatMessage::new().set_text("Message2"),
];

client.send_messages(msgs).await?;

lib.rs:

RocketChat Message for Rust

This library is an implementation of rocket chat hooks for messages

  • Send text example
let client = RocketChat::new("ROCKET_CHAT_WEBHOOK_URL", "#channel");

client.send_text("Text").await?;
  • Send message example
let client = RocketChat::new("ROCKET_CHAT_WEBHOOK_URL", "#channel");

let msg = RocketChatMessage::new()
    .set_text("Text")
    .set_attachments(vec![RocketChatAttachment::new()
        .set_title("Attachment title")
        .set_title_link("https://google.fr")
        .set_text("Attachment text")
        .set_author_name("Author name")
        .set_color("#c97149")]);

client.send_message(msg).await?;
  • Send messages example
let client = RocketChat::new("ROCKET_CHAT_WEBHOOK_URL", "#channel");

let msgs = vec![
    RocketChatMessage::new().set_text("Message1"),
    RocketChatMessage::new().set_text("Message2"),
];

client.send_messages(msgs).await?;

Dependencies

~4–16MB
~216K SLoC