-
-
Save kengggg/349119a960e32120200b5590a193a331 to your computer and use it in GitHub Desktop.
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
# Pre-requisite | |
# - jq | |
# | |
# IFTTT Webhooks | |
# 1. Create an IFTTT Webhooks widget and define an event name | |
# 2. Get IFTTT Webhooks user key through Webhook's documentation | |
#!/bin/bash | |
IFTTT_EVENT_NAME="" | |
IFTTT_USER_KEY="" | |
# apple pay country code | |
CC="TH" | |
FOUND=false | |
function check { | |
RET=$(curl -s https://smp-device-content.apple.com/static/region/v2/config.json | jq .SupportedRegions.$CC) | |
([ $?==0 ] && echo $RET) || echo "null" | |
} | |
function push { | |
curl -X POST https://maker.ifttt.com/trigger/$IFTTT_EVENT_NAME/with/key/$IFTTT_USER_KEY | |
} | |
while [ $FOUND = false ]; do | |
R=$(check) | |
if [ "$R" != "null" ]; then | |
push | |
echo $R | |
FOUND=true | |
else | |
echo "No Apple Pay in $CC :(" | |
fi | |
sleep 15; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment