Created
May 20, 2016 09:00
-
-
Save lluft/214a0d6ce7ef9577af2d2eda3a7920df 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
#!/bin/bash | |
path=$(mktemp -d) | |
risk=$RISK_SCORE | |
if ! [ $WEBHOOK_URL ] | |
then | |
echo "You need to provide a WEBHOOK_URL." | |
exit 1 | |
fi | |
if ! [ $USER_ID ] | |
then | |
echo "You need to provide a USER_ID." | |
exit 1 | |
fi | |
if ! [ $risk ] | |
then | |
risk='0.4' | |
fi | |
curl -v \ | |
-u:"secret" \ | |
-D $path/headers \ | |
'http://api.lvh.me:3001/v1/generates/alert?risk='$risk'&user_id='$USER_ID > $path/data | |
curl -v \ | |
-H "$(cat $path/headers | grep 'X-Castle-Signature')" \ | |
-H "$(cat $path/headers | grep 'X-Castle-App-Id')" \ | |
-H "Accept:application/json" \ | |
-H "Content-Type:application/json" \ | |
-H "Accept-Encoding:gzip,deflate" \ | |
-H "User-Agent:Castle webhook" \ | |
-X POST -d @$path/data $WEBHOOK_URL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment