Created
June 19, 2020 09:14
-
-
Save 20chan/5716080202fdf32987c76e73021ea03d to your computer and use it in GitHub Desktop.
ifttt webhook script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
_usage() { | |
echo "Usage: $0 <event> [value1] [value2] [value3]" | |
} | |
if [ -z "$1" ]; then | |
_usage | |
exit 1 | |
fi | |
SCRIPT=$(readlink -f "$0") | |
SCRIPTPATH=$(dirname "$SCRIPT") | |
KEYPATH="${SCRIPTPATH}/key" | |
KEY=$(cat "$KEYPATH") | |
EVENT_NAME=$1 | |
URL="https://maker.ifttt.com/trigger/${EVENT_NAME}/with/key/${KEY}" | |
curl \ | |
-X POST \ | |
-H "Content-Type: application/json" \ | |
-d $(printf '{"value1":"%q","value2":"%q","value3":"%q"}' $2 $3 $4) \ | |
$URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment