Skip to content

Instantly share code, notes, and snippets.

@lluft
Created May 20, 2016 09:00
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 lluft/214a0d6ce7ef9577af2d2eda3a7920df to your computer and use it in GitHub Desktop.
Save lluft/214a0d6ce7ef9577af2d2eda3a7920df to your computer and use it in GitHub Desktop.
#!/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