How to Generate API Keys for Content Previews and Configure it in HipChat Server
Currently content previews (for services like YouTube, Imgur, Twitter) in HipChat Server are disabled. This page outline the steps to generate the API keys for the services, the configuration to enable the previews, known limitation and troubleshooting bad key error from the logs.
Retrieving the API keys
- Create an application from https://apps.twitter.com/app/new (use the URL of your server)
- Record the consumer key and consumer secret
- Retrieve a bearer token from Twitter, using the instructions listed here (refer to this script for an example)
- Navigate to https://console.developers.google.com/apis, and either create a new project, or select an existing one
- Enable the youtube v3 API for your project by going to https://console.developers.google.com/apis/api/youtube/overview and clicking on the 'Enable' button at the top
- Go to https://console.developers.google.com/apis/credentials and create an API Key credential
- Leave the IP restriction open, and save the key
- Create an Imgur application via https://api.imgur.com/oauth2/addclient with these specifications:
- Give it a meaningful name
- Choose authorization type: OAuth 2 authorization type without a callback URL
- Leave the authorization callback URL empty
- Enter your email
- Click submit
- Save the client_id and secret key somewhere safe, as they can't be retrieved later.
- Create a personal token from https://github.com/settings/tokens
- Check the repo:status and public_repo scopes
- Click Generate Token
- Save the generated token somewhere save, as it can't be retrieved later
- Login and view your api key via https://app.bitly.com/default/bitlinks/?actions=accountMain&actions=settings&actions=advancedSettings&actions=apiSupport
Once you have a key(s), do the following:
SSH to your HipChat Server deployment as the admin user
Escalate to root privilege by running the command:
Update the parameters by filling in the blanks of the services you're using with the keys generated.
If you are running on HipChat Server 2.1.3 or earlier, please use the hipchat-scm/chef-repo/data_bags/configs-btf/api_keys.json file
If you are running on HipChat Server 2.2.0, please use the /hipchat-scm/chef-repo/cookbooks/hipchat/attributes/hipchat.rb instead
Exit root privilege escalation by running the command:
Apply the new configuration and restart services by running the command:
Note this command will not initiate a version upgrade.
Keys will be reset to empty on a HipChat Server upgrade. We will provide a more user-friendly way to configure these keys via GUI in the future.
You will see the following error in /var/log/hipchat/tetra.log if a wrong/bad key is specified:
Was this helpful?
Thanks for your feedback!