Skip to content

Instantly share code, notes, and snippets.

@kengggg
Forked from ds82/check_applepay.sh
Last active July 19, 2020 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kengggg/349119a960e32120200b5590a193a331 to your computer and use it in GitHub Desktop.
Save kengggg/349119a960e32120200b5590a193a331 to your computer and use it in GitHub Desktop.
# 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