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

#10 in #flows

Download history 5/week @ 2024-06-12 6/week @ 2024-06-19 9/week @ 2024-06-26 32/week @ 2024-07-24 11/week @ 2024-07-31 2/week @ 2024-08-07 18/week @ 2024-08-14 14/week @ 2024-09-11 17/week @ 2024-09-18 24/week @ 2024-09-25

55 downloads per month

MIT/Apache

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