A simple Rust async library for triggering IFTTT events using webhooks.
Installation can be performed using cargo add
:
sh
cargo add ifttt-webhook
```rust use ifttt_webhook::IftttWebhook; use std::collections::HashMap;
// IFTTT Webhook key, available under "Documentation" // at https://ifttt.com/makerwebhooks/. let iftttkey = 'youriftttwebhook_key';
let webhook = IftttWebhook { key: iftttkey, event: "eventname", };
// this will trigger a GET to https://maker.ifttt.com/trigger/{event}/with/key/{key} webhook.trigger(None).await; ```
The .trigger
method can be used to pass values as shown in the example below:
```rust
use ifttt_webhook::IftttWebhook;
// IFTTT Webhook key, available under "Documentation" // at https://ifttt.com/makerwebhooks/. let iftttkey = 'youriftttwebhook_key';
let mut values = HashMap::new(); values.insert("value1", "value1testvalue"); values.insert("value2", "value2testvalue"); values.insert("value3", "value3test_value");
let webhook = IftttWebhook { key: iftttkey, event: "eventname", };
// this will trigger a POST to https://maker.ifttt.com/trigger/{event}/with/key/{key} webhook.trigger(Some(&values)).await; ```
If you discover a bug please report it here. Express gratitude here.
Mail me at leodutra.br+foss@gmail.com, or on twitter @leodutra.
MIT @ Leo Dutra