All Projects → frostly → Rust Slack

frostly / Rust Slack

Licence: other
A rust crate for sending messages to Slack via webhooks

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Rust Slack

notify
推送通知 sdk(Bark、Chanify、钉钉群机器人、Discord、邮件、飞书群机器人、Gitter、Google Chat、iGot、Logger、Mattermost、Now Push、PushBack、Push、PushDeer、PushPlus、QQ 频道机器人、Rocket Chat、Server 酱、Showdoc Push、Slack、Telegram、Webhook、企业微信群机器人、息知、Zulip)。
Stars: ✭ 335 (+161.72%)
Mutual labels:  slack, webhook
Tradingview Webhook Bot
⚙️ Send TradingView alerts to Telegram, Discord, Slack, Twitter and/or Email.
Stars: ✭ 135 (+5.47%)
Mutual labels:  webhook, slack
Hooka
😎 A webhook server with zero coding
Stars: ✭ 180 (+40.63%)
Mutual labels:  webhook, slack
pr-reviews-reminder-action
A GitHub Action to send Slack/Teams notification for Pull Request that are waiting for reviewers.
Stars: ✭ 18 (-85.94%)
Mutual labels:  slack, webhook
zoom-slack-status-updater
Update your Slack status automatically when you join a Zoom meeting.
Stars: ✭ 23 (-82.03%)
Mutual labels:  slack, webhook
SlackWebhooksGithubCrawler
Search for Slack Webhooks token publicly exposed on Github
Stars: ✭ 21 (-83.59%)
Mutual labels:  slack, webhook
iris
Watch on Kubernetes events, filter and send them as standard wehbook to any system
Stars: ✭ 57 (-55.47%)
Mutual labels:  slack, webhook
Zabbix Slack Alertscript
Zabbix AlertScript for Slack.com chat
Stars: ✭ 406 (+217.19%)
Mutual labels:  webhook, slack
Tfsnotificationrelay
An extensible plugin for TFS that sends notifications to Slack, HipChat and IRC
Stars: ✭ 120 (-6.25%)
Mutual labels:  slack
Promplot
Create plots from Prometheus metrics and send them to you
Stars: ✭ 125 (-2.34%)
Mutual labels:  slack
Destalinator
Code for managing Cleanup of Stale Channels
Stars: ✭ 115 (-10.16%)
Mutual labels:  slack
Clj Slack
Use Slack REST API from Clojure
Stars: ✭ 119 (-7.03%)
Mutual labels:  slack
Botserver
http://telegram.org Bot API Webhooks Framework, for Rubyists
Stars: ✭ 125 (-2.34%)
Mutual labels:  webhook
Pokevision Cli
PokéVision has shutdown (for now). Follow @PokeVisionGo on Twitter for updates.
Stars: ✭ 118 (-7.81%)
Mutual labels:  slack
Assent
Multi-provider framework in Elixir
Stars: ✭ 126 (-1.56%)
Mutual labels:  slack
Slack Sql
🎉 Bring SQL console to Slack
Stars: ✭ 115 (-10.16%)
Mutual labels:  slack
Realtimechat
Open source, native iOS Messenger, with realtime chat conversations (full offline support).
Stars: ✭ 1,511 (+1080.47%)
Mutual labels:  slack
Irslackd
Self-hosted IRC gateway to Slack
Stars: ✭ 128 (+0%)
Mutual labels:  slack
Tsuru
desktop client.
Stars: ✭ 126 (-1.56%)
Mutual labels:  slack
Pm2 Slack
A PM2 module to emit events to Slack
Stars: ✭ 124 (-3.12%)
Mutual labels:  slack

rust-slack

Travis Build Status Documentation crates.io MIT licensed Apache licensed

A rust crate for sending messages to Slack via webhooks.

Slack is a messaging platform for team collaboration.

Upgrading? See the CHANGELOG.

Requires rust 1.17 or newer.

Usage

Add this to your Cargo.toml:

[dependencies]
slack-hook = "0.7"

Add the crate to your existing project:

extern crate slack_hook;
use slack_hook::{Slack, PayloadBuilder};

fn main() {
    let slack = Slack::new("https://hooks.slack.com/services/abc/123/45z").unwrap();
    let p = PayloadBuilder::new()
      .text("test message")
      .channel("#testing")
      .username("My Bot")
      .icon_emoji("📈")
      .build()
      .unwrap();

    let res = slack.send(&p);
    match res {
        Ok(()) => println!("ok"),
        Err(x) => println!("ERR: {:?}",x)
    }
}

Attachments

To create a payload with just an attachment:

extern crate slack_hook;
use slack_hook::{PayloadBuilder, AttachmentBuilder};

fn main() {
  let _ = PayloadBuilder::new()
    .attachments(vec![AttachmentBuilder::new("my text").color("#b13d41").build().unwrap()])
    .build()
    .unwrap();
}

Text with Links

Slack messaging API permits you to send links within text. However, given the different formatting rules, these text fragments need to be specified as follows:

extern crate slack_hook;
use slack_hook::{PayloadBuilder, SlackTextContent, SlackLink};
use slack_hook::SlackTextContent::{Text, Link};

fn main() {
  let _ = PayloadBuilder::new()
    .text(vec![
      Text("Hello".into()),
      Link(SlackLink::new("https://google.com", "Google")),
      Text(", nice to know you.".into())
    ].as_slice())
    .build()
    .unwrap();
}

Sending this payload will print the following in slack (note: each element of the Vec has been space-separated):

      Hello Google, nice to know you.

This technique can be used for any function that has the Into<SlackText> trait bound.

License

This library is distributed under similar terms to Rust: dual licensed under the MIT license and the Apache license (version 2.0).

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].