I am trying to create a room using the HipChat API as soon as a user installs our add-on. However, I am now not able to create the room as I do not have the 'owner_user_id' which according to the documentation is not a mandatory field. Documentation says it defaults to the current user's id. But it still says 'Must be a valid room owner'.
How do I determine the user id of the user who installed the add-on? The installation data does not have the id of the user who installed the add-on.
Hi Aiyappa, it sounds like you might need to provide an owner ID for the room when making the call from an add-on context. This is because there's no "current" user associated with the addon (as opposed to making the request using a personal API key, which does have a user associated with it).
I'd recommend using the User API to search for an appropriate user or keeping a cached value to be used as the owner ID of the rooms you're creating. Alternatively, you can probably retrieve the installer's user ID at install time and store it for later use.
Thank you for the insightful response! I did consider the suggestions. As any public HipChat team might want to install the add-on into their rooms, I would not have access to any of their users until they install my add-on and interact with it. So that option does not work for me if I want to create the room as soon as the add-on has been installed.
The alternative approach of retrieving the installer's user ID at install time is the route I would prefer taking. However, I do not see any user information in the installation data received at the installation callback.
Appreciate if you could provide steps on retrieving the installer's User ID.
Hmm - glancing over the docs, I don't actually see a way to retreive the installing user, only the group ID (and potentially room ID). That might be a mistake on my part. In that case. In that case, as long as your addon has the proper scope, you could make a request to /v2/user to find a user to with Title Expansion in order to find a group.
I'll add this as an improvement request to our API team - it sounds like it could be something useful to have during installation time :)
All good things come to an end - thanks to all our customers and partners who have been along the Hipchat and Stride journey with us. As of Feb 15th 2019, Hipchat Cloud and Stride have reached ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event