Last active
December 20, 2015 03:39
-
-
Save woodja/6065423 to your computer and use it in GitHub Desktop.
HipChat notification command, which can be used as part of deploy scripts, test automation, etc.
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 | |
# Make sure to add your token and room id | |
# Input is from standard input, so you can run it like | |
# echo "This is a test" | hipchat_echo.sh | |
# date | hipcaht_echo.sh | |
# cat results.log | hipchat_echo.sh | |
# hipchat_echo.sh | |
# my quick message ^D | |
TOKEN={Your room API token} | |
ROOM_ID={Your room ID} | |
COLOR=green | |
FROM=$USER | |
NOTIFY=1 | |
read MESSAGE | |
HOST='api.hipchat.com' | |
INPUT=$(echo -n "${MESSAGE}" | perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg') | |
curl -sS \ | |
-d "auth_token=$TOKEN&room_id=$ROOM_ID&from=$FROM&color=$COLOR&message=$INPUT¬ify=$NOTIFY" \ | |
https://$HOST/v1/rooms/message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment