Crates.io | ifttt-webhook |
lib.rs | ifttt-webhook |
version | 0.3.2 |
source | src |
created_at | 2020-11-09 22:55:07.460079 |
updated_at | 2021-03-11 10:46:48.592739 |
description | Simple async library for triggering IFTTT events using webhooks. |
homepage | |
repository | https://github.com/leodutra/ifttt-webhook |
max_upload_size | |
id | 310508 |
size | 9,284 |
A simple Rust async library for triggering IFTTT events using webhooks.
Installation can be performed using cargo add
:
cargo add ifttt-webhook
use ifttt_webhook::IftttWebhook;
use std::collections::HashMap;
// IFTTT Webhook key, available under "Documentation"
// at https://ifttt.com/maker_webhooks/.
let ifttt_key = 'your_ifttt_webhook_key';
let webhook = IftttWebhook {
key: ifttt_key,
event: "event_name",
};
// 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:
use ifttt_webhook::IftttWebhook;
// IFTTT Webhook key, available under "Documentation"
// at https://ifttt.com/maker_webhooks/.
let ifttt_key = 'your_ifttt_webhook_key';
let mut values = HashMap::new();
values.insert("value1", "value_1_test_value");
values.insert("value2", "value_2_test_value");
values.insert("value3", "value_3_test_value");
let webhook = IftttWebhook {
key: ifttt_key,
event: "event_name",
};
// 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