Create a gist now

Instantly share code, notes, and snippets.

HipChat API v2 - Send a message to a room using cURL
# Set the ROOM_ID & AUTH_TOKEN variables below.
# Further instructions at
MESSAGE="Hello world!"
curl -H "Content-Type: application/json" \
-d "{\"color\": \"purple\", \"message_format\": \"text\", \"message\": \"$MESSAGE\" }" \$ROOM_ID/notification?auth_token=$AUTH_TOKEN

I had to change notification for message to make it work!

danriti commented Apr 23, 2014

@juanmaflyer, thanks for the comment, I updated the gist!

Jhloa2 commented Aug 5, 2014

Thanks so much for this!


If you want to send the token in the Auth header instead, you can do this:

curl -H "Content-type: application/json" \
-H "Authorization: Bearer $AUTH_TOKEN" \
-d "{\"color\": \"purple\", \"message_format\": \"text\", \"message\": \"$MESSAGE\"}" \$ROOM_ID/notification

Has anyone gotten this to work using a group notification token?


It does not work for me. It throws

  "error": {
    "code": 401,
    "message": "Authenticated requests only. See for more information.",
    "type": "Unauthorized"
dkarter commented Dec 8, 2014

It worked for me with personal auth token. Otherwise I was getting

  "error": {
    "code": 401,
    "message": "Invalid OAuth session",
    "type": "Unauthorized"

any idea how to get it to work with a room notification token?

bvulaj commented Jan 14, 2015

If you generate a token for a specific room, this script works.


It's quite weird that it doesn't work with an admin token, isn't it?

buren commented Jan 26, 2015

This works for me..:

MESSAGE="Hello world!"

curl --header "content-type: application/json" --header "Authorization: Bearer $AUTH_TOKEN" -X POST \
  -d "{\"name\":\"dev\",\"privacy\":\"private\",\"is_archived\":false,\"is_guest_accessible\":false,\"topic\":\"cURL\",\"message\":\"Message sent to HipChat from cURL\",\"color\":\"green\",\"owner\":{\"id\":$OWNER_ID}}"$ROOM_ID/notification

Also can't get Auth Token i keep getting the 401 code.

Anybody know how to get this token back correctly?

edit: @BVulaj was right. you can just generate a token by trying to go to:



Would I be able to alert a hipchat room via analytics unique visitor?


Thanks for posting this - it's a useful example

udomsak commented Aug 19, 2015

Thank you for sharing but i can't not follow your scripted.

regsmith commented Sep 8, 2015

Any luck sending attachments with curl?


Thanks a lot, works fine


Had to generate a token for that specific room, then it worked for me. 👍


Thanks for posting this.

Works great using a room api ID. If the room name has an embedded "/" in it, it doesn't seem to work even if I URL encode the room name.

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