How to export Hipchat Karma points
Purpose
If you've been using the Hipchat Karma bot and are moving away of Hipchat Server/Data Center, you will lose track of all Karma points for your users.
Solution
Top & bottom 10 Karma users
Send the following to a room with the Karma plugin installed:
/karma :top users
/karma :bottom users
Export all Karma data
- Generate a user API token with the scope send_message
- Create a dummy Karma room
Loop over all user mentions from the DB and send API calls from the server itself as follows:
curl -d '{"message": "/karma @UserMention", "notify": false, "message_format": "text"}' -H 'Content-Type: application/json' 'https://<fqdn>/v2/room/<room_id>/message?auth_token=<auth_token>'
* You will need to introduce a sleep of 3 seconds or so as you loop over the users to not exceed the API rate limiting of 100 calls per 5 minutes.
* This will mention all users one by one.
- Once the run is done and all users Karma is returned, export the room history via View room history
- Parse the output and generate a list of all users and their Karma points