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

#2170 in Network programming

Download history 42/week @ 2023-12-17 81/week @ 2023-12-24 36/week @ 2023-12-31 34/week @ 2024-01-07 72/week @ 2024-01-14 67/week @ 2024-01-21 35/week @ 2024-01-28 93/week @ 2024-02-18 53/week @ 2024-02-25 27/week @ 2024-03-03 41/week @ 2024-03-10 3/week @ 2024-03-17 26/week @ 2024-03-24 151/week @ 2024-03-31

224 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
~61K SLoC