Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Create as an add-on/integration #47

Open
brycekahle opened this issue Mar 10, 2015 · 10 comments
Open

Create as an add-on/integration #47

brycekahle opened this issue Mar 10, 2015 · 10 comments

Comments

@brycekahle
Copy link

https://www.hipchat.com/docs/apiv2/addons

That way you don't have to create and pay for an extra user.

@bettin
Copy link

bettin commented Mar 10, 2015

+1

@parautenbach
Copy link
Owner

Hi there

Please have a look at this comment for an explanation.

@brycekahle
Copy link
Author

@parautenbach An add-on can definitely be installed globally.

An add-on can request access to the HipChat APIs, and depending on whether it is installed into a room or globally, can declare the OAuth scopes it needs to operate. It is then up to the room or group administrator to approve the add-on, and once that happens, the add-on gets its own OAuth ID and secret for retrieving tokens as described in the authentication documentation.

@parautenbach
Copy link
Owner

That must be new information compared to the time of writing of my comment. Could you provide a link please?

@brycekahle
Copy link
Author

@parautenbach See issue body for link.

@parautenbach
Copy link
Owner

I read this differently: The v2 API requires a personal access token, so the token is still tied to a user account, e.g. as you would see at https://{yoursubdomain}.hipchat.com/account/api. This is what is currently used. You're welcome to point out where exactly to create a v2 API token that is not tied to a particular user account, in which case I will definitely invest more time in it. I have unfortunately not been able to find that. The tokens I was able to create couldn't list rooms, but only send notifications.

@brycekahle
Copy link
Author

From https://www.hipchat.com/docs/apiv2/auth

The HipChat API uses OAuth 2 to allow you to authenticate as either a user or as an add-on.

An add-on - If you are building a long-lived integration, you may want to register it as an add-on. This, among other things, allows you to access the API as an application, which usually means a generic administrator.

@keithrz
Copy link

keithrz commented Apr 21, 2015

The current TeamCity add-on for HipChat provides an auth token, but it is API v1. For API v2, you'd want a group client token generated.

I was trying to figure out how to create a group client token as a HipChat admin. But you need to create it from within an add-on.

So, who owns the TeamCity add-on for HipChat? They should modify the add-on so that it generates an API v2 group client token instead of API v1 (or both, or provide an option to the HipChat admin.)

@parautenbach
Copy link
Owner

I am the author and owner of this plugin, if that's what you're referring to. Before the new Atlassian Marketplace with HipChat add-ons was launched, this plugin (which is a TeamCity plugin, and not a HipChat plugin or add-on as such) was listed on their old site. When they launched the new site they must've done some conversion to list existing integrations as a way to seed it with existing integrations, so I had no control over that. Due to the way they did this, the marketplace generates a v1 token.

The group functionality seem to have been added very recently, or I had a very trivial oversight. (The imports and invites API endpoints also seem very new though.)

I have experimented with the new token API, but haven't succeeded in creating anything but a personal access token with it, which doesn't solve anything.

So, if anybody can show a working example (say as a script in the language of your choice), it would be very helpful. Simply posting links to documentation is of little help as it demonstrates nothing.

@keithrz
Copy link

keithrz commented May 2, 2015

I was referring to the HipChat Marketplace add-on. It is obvious that you are the owner of the TeamCity plugin.

I have no knowledge of HipChat Marketplace add-ons, but I guess I'll have to figure it out. The TeamCity plugin is not very helpful if it means having to pay for an extra user just to use it. In my team, we've reverted to using tcwebhooks in TeamCity using HipChat v1 API, because it doesn't cost us a HipChat user.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants