Skip to content

Instantly share code, notes, and snippets.

@danriti
Last active July 19, 2021 10:49
  • Star 75 You must be signed in to star a gist
  • Fork 15 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save danriti/7345074 to your computer and use it in GitHub Desktop.
HipChat API v2 - Send a message to a room using cURL
#!/bin/bash
# Set the ROOM_ID & AUTH_TOKEN variables below.
# Further instructions at https://www.hipchat.com/docs/apiv2/auth
ROOM_ID=XXX
AUTH_TOKEN=XXX
MESSAGE="Hello world!"
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"color\": \"purple\", \"message_format\": \"text\", \"message\": \"$MESSAGE\" }" \
https://api.hipchat.com/v2/room/$ROOM_ID/notification?auth_token=$AUTH_TOKEN
Copy link

ghost commented Feb 28, 2016

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.

@rquadling
Copy link

@ronjons
Copy link

ronjons commented Nov 28, 2017

What would be the syntax to send it to a single user: @username or @ALL in a room? Or is that not possible?

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