3 unstable releases
0.2.1 | Mar 3, 2023 |
---|---|
0.2.0 | Feb 13, 2023 |
0.1.0 | Feb 2, 2023 |
#10 in #tweet
5KB
This is a library for integrating Twitter in your flow function for flows.network.
Usage example
use twitter_flows::create_tweet;
use slack_flows::{channel_msg_received};
#[no_mangle]
pub fn run() {
if let Some(sm) = channel_msg_received("myworkspace", "mychannel") {
let tweet = serde_json::json!({
"text": sm.text,
});
create_tweet(tweet);
}
}
When a new message is received from mychannel
, we will create a new tweet in Twitter using create_tweet
.
The whole document is here.
lib.rs
:
Twitter integration for Flows.network
Quick Start
To get started, let's write a very tiny flow function.
use twitter_flows::create_tweet;
use slack_flows::{channel_msg_received};
#[no_mangle]
pub fn run() {
if let Some(sm) = channel_msg_received("myworkspace", "mychannel") {
let tweet = serde_json::json!({
"text": sm.text,
});
create_tweet("mytwitteruser", tweet);
}
}
When the Slack message is received, create a new tweet in Twitter using [create_tweet].
Dependencies
~1–2MB
~42K SLoC