Skip to content

Instantly share code, notes, and snippets.

@HokieGeek
Last active December 1, 2017 16:24
Show Gist options
  • Save HokieGeek/b7fd3dbe011a47df9f8f09dee43044ea to your computer and use it in GitHub Desktop.
Save HokieGeek/b7fd3dbe011a47df9f8f09dee43044ea to your computer and use it in GitHub Desktop.
IFTTT Maker Channel Bash Script
#!/bin/bash
(( $# <= 0 )) && exit 1
key=REPLACE_ME
read event values <<<$(echo -n "$@" | awk 'NR > 1 { $0=sprintf("\"value%d\":\"%s\",", NR-1, $0) } 1' RS=' ' ORS=' ' | sed 's/, $//')
curl --request POST \
--header 'Content-Type: application/json' \
--data '{'"${values}"'}' \
https://maker.ifttt.com/trigger/${event}/with/key/${key}
@HokieGeek
Copy link
Author

or

values=()
(( $# >= 1 )) && values+=('"value1":"'$1'"')
(( $# >= 2 )) && values+=('"value2":"'$2'"')
(( $# >= 3 )) && values+=('"value3":"'$3'"')
     --data '{'"${values[*]}"'}' \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment