Crate slack_flows

source ·
Expand description

Slack integration for Flows.network

Quick Start

To get started, the easist way is to write a flow function that acts as a Hello World Slack bot.

use slack_flows::{channel_msg_received, send_message_to_channel};

#[no_mangle]
pub fn run() {
    if let Some(sm) = channel_msg_received("myworkspace", "mychannel") {
        send_message_to_channel("myworkspace", "mychannel", format!("Hello, {}", sm.text));
    }
}

channel_msg_received() is responsible for registering a listener for channel mychannel of workspace myworkspace. Whenever a new message is sent to the channel, the message is returned then send_message_to_channel() is used to send a response message to the same channel.

Structs

A struct corresponding to the Slack event API
A struct corresponding to the Slack message API

Functions

Create a listener for channel channel_name of workspace team_name and return the event body.
Revoke previous registered listener of current flow.
Send message to channel channel_name of workspace team_name.
Upload a file to channel channel_name of workspace team_name.