Crate webhook_flows
source ·Expand description
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.
Modules
Structs
- The Request Method (VERB)
Functions
- Register a callback closure with the query and body of the request for the webhook service.
- Set the response for the webhook service.