HipChat notification isn't working

I set up HipChat notification in the same way I did with the other tools.

I entered the room name (also tried with the API room number) and the token created on the HipChat website (room settings -> tokens).
Hit save & test hook and I receive:

Error: Hook failed. If we can help, contact us.

Then on builds, after they have finished, it says:

Warning: Hipchat notification failed: Auth token invalid. Please see: https://www.hipchat.com/docs/api/auth

This references the version 1 API which is deprecated in favor of version 2 https://www.hipchat.com/docs/apiv2

Wanting to test the error myself, I tried both versions of the API (using the same token I set up for CircleCI):
V2

curl --header "content-type: application/json" --header "Authorization: Bearer Token" -X POST -d '{"message":"Test"}' https://api.hipchat.com/v2/room/RoomName/notification

Wroked and I saw the notification.

V1

curl --header "content-type: application/x-www-form-urlencoded" -X POST -d '{"room_id":"RoomIDOrName", "from":"CircleCI", "message":"Test2"}' https://api.hipchat.com/v1/rooms/message\?format\=json\&auth_token\=Token

Returned:

{"error":{"code":401,"type":"Unauthorized","message":"Auth token invalid. Please see: https:\/\/www.hipchat.com\/docs\/api\/auth"}}

I also tried testing the token (as described at https://www.hipchat.com/docs/api/auth):

curl https://api.hipchat.com/v1/rooms/message\?auth_token\=Token\&auth_test\=true

Which returned the same error as above.

I contacted the support team and made this post at their request.

UPDATE

I managed to get this working.

Go to integrations on HipChat once you’re signed in, and search for CircleCI. Configure the integration, you’ll get the room id (number) and the token. Paste them in the CircleCI chat notifications settings and you’re done!

Previously I have created the token manually, from the tokens page in room settings.

I suggest making a note in the docs.

This post can be marked as solved.

Thanks so much for posting the solution! :slight_smile: