Skip to content

Instantly share code, notes, and snippets.

@danriti
Last active May 21, 2022 23:13
Show Gist options
  • Save danriti/3095606 to your computer and use it in GitHub Desktop.
Save danriti/3095606 to your computer and use it in GitHub Desktop.
HipChat - Send a message to a room using cURL
# Build Passes
curl -d "room_id=ourRoom&from=BuildBot&message=Build+Status:+Passing&color=green" https://api.hipchat.com/v1/rooms/message?auth_token=AUTH_TOKEN_HERE&format=json
# Build Fails
curl -d "room_id=ourRoom&from=BuildBot&message=Build+Status:+Failing&color=red&notify=1" https://api.hipchat.com/v1/rooms/message?auth_token=AUTH_TOKEN_HERE&format=json
@tizzo
Copy link

tizzo commented Feb 14, 2014

I found the following helpful:

MESSAGE="Some crazy unescaped message with <a href=\"http://somewhere.com\">links</a> & stuff! Maybe even variables or commit messages: ${COMMIT_MESSAGE}"
CONFIG="room_id=FruitGuys&from=Jenkins&color=yellow"
curl -d $CONFIG --data-urlencode "message=${MESSAGE}" 'https://api.hipchat.com/v1/rooms/message?auth_token=yourtokengoeshere&format=json'

This way the message is separated out more clearly and you let curl do the encoding for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment