9 unstable releases (3 breaking)
0.4.4 | Nov 6, 2023 |
---|---|
0.4.3 | Nov 6, 2023 |
0.4.1 | Oct 24, 2023 |
0.4.0 | Sep 1, 2023 |
0.1.0 | Aug 15, 2023 |
#13 in #flows
13KB
227 lines
This is an integration for making your flow function triggerable from webhooks in flows.network.
For details, please refer to Webhook Integration.
lib.rs
:
Make a flow function triggerable from webhooks in Flows.network
Quick Start
To get started, let's write a very tiny flow function.
use webhook_flows::{create_endpoint, request_handler, send_response};
#[no_mangle]
#[tokio::main(flavor = "current_thread")]
pub async fn on_deploy() {
create_endpoint().await;
}
#[request_handler]
async fn handler(_headers: Vec<(String, String)>, _subpath: String, _qry: HashMap<String, Value>, _body: Vec<u8>) {
send_response(
200,
vec![(String::from("content-type"), String::from("text/html"))],
"ok".as_bytes().to_vec(),
);
}
When a new request is received the function handler
decorated by macro [request_handler] will be called and [send_response()] is used to make the response.
Dependencies
~2–3MB
~63K SLoC