Unable to create room

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.

1 answer

0 vote

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.

Hi Christopher,

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 :)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Hipchat

Moving from Hipchat to Stride? Here’s what you’ll love

Heya, Hipchat friends! We’re so happy you’re checking out   Stride. Whether you know it or not, you have been instrumental in making Stride come to life. Every feature, design, and functionality...

134 views 3 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you