Skip to content

Instantly share code, notes, and snippets.

@peacefixation
Last active March 6, 2019 23:47
Show Gist options
  • Save peacefixation/bf3e166a6ac0cf3f0b7d80555cd279f9 to your computer and use it in GitHub Desktop.
Save peacefixation/bf3e166a6ac0cf3f0b7d80555cd279f9 to your computer and use it in GitHub Desktop.
Send a hipchat alert
#!/bin/bash
# https://www.hipchat.com/docs/apiv2/method/send_room_notification
AUTH_TOKEN="" # generate an auth token from the hipchat admin interface
ROOM_ID=1 # get the room id from the hipchat admin interface
HIPCHAT_URL="https://api.hipchat.com/v2/room" # or self hosted hiphat URL
FROM="some sender"
MESSAGE="some message"
COLOR="red"
curl -H "Content-type: application/json" \
-H "Authorization: Bearer ${AUTH_TOKEN}" \
-X POST \
-d "{\"from\": \"${FROM}\", \"message_format\": \"text\", \"message\": \"${MESSAGE}\", \"color\": \"${COLOR}\", \"notify\": \"true\"}" \
${HIPCHAT_URL}/${ROOM_ID}/notification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment