-
-
Save danriti/7345074 to your computer and use it in GitHub Desktop.
#!/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 |
This works for me..:
ROOM_ID=yourroomname
OWNER_ID=XXXYYYX
AUTH_TOKEN=XXXYYYXXX
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}}" https://api.hipchat.com/v2/room/$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:
https://your-company.hipchat.com/rooms/tokens/XXXX
cheers!
Would I be able to alert a hipchat room via analytics unique visitor?
Thanks for posting this - it's a useful example
Thank you for sharing but i can't not follow your scripted.
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.
I use the v1 api - https://gist.github.com/rquadling/29d37938b1001345c643eb9832bfda7f
What would be the syntax to send it to a single user: @username or @ALL in a room? Or is that not possible?
It's quite weird that it doesn't work with an admin token, isn't it?