Migrate HipChat Hubots to Stride

Migrate HipChat Hubots to Stride

Atlassian got its new fancy tool Stride to replace HipChat and it's gradually migrate existing HipChat teams to Stride. For those Hubots connecting to HipChat, it's time to migrate. This post shows the complete migration process for my own ChatOps bot.

Code changes

The required code changes for the migration are actually quite minimal. We only need to replace package hubot-hipchat with hubot-stride, and change the Hubot start command to hubot --adapter stride. No other code changes are required.

Configurations

When using with HipChat, Hubot works as a member of the team, so it requires its own user account in the team. In Stride, Hubots are now treated as apps to be installed for each room. So each Hubot needs to be registered as a Stride app. Following steps below to create a new Stride app.

Following steps are copied from hubot-stride package's README file.

Create a Stride app

Create a Stride app in developer.atlassian.com

  • Give your new app a name in the App name field.
  • If desired, add a short description in the Description field.
  • Click Create; you'll be directed to your app's dashboard page.
  • Click Enable API for the Stride API.
  • Click Add for the Manage conversation scope
  • Click Enable API for the User API
  • In the Enabled APIs tab, make a note of the client ID and the client secret.
  • In the App Features tab, enable Bot account and make note of the bot mention name

Now we have the client ID and client secret for the Hubot.

Configure Hubot

We need four extra system environment variables to configure Hubot.

  • HUBOT_STRIDE_CLIENT_ID - Hubot app client ID
  • HUBOT_STRIDE_CLIENT_SECRET - Hubot app client secret
  • HUBOT_ALIAS - Hubot app mention name
  • HUBOT_NAME - Use the same value as HUBOT_ALIAS

I just add these new environment variables to my Docker container.

Setup the Hubot server

Stride adapter for Hubot starts a web server at port 8000 for communications with Stride server. It also serves the descriptor of the app. The descriptor URL is required when generating the installation URL for the app. The descriptor URL must be accessible to Atlassian, so it needs to be a public URL. The URL also must be using https. This shouldn't be a big issue on AWS as AWS provides free SSL certificates. The descriptor URL looks like https://www.mycompany.com/descriptor.

App installation

In the app's dashboard page, switches to the Install tab and input the descriptor URL, then you can get the installation URL. Go to a Stride room and opens the Apps sidebar, the clicks the plus icon to open the Atlassian Marketplace page. Clicks Add custom app and paste the installation URL. Then you should see the new app appears. In the conversion, you can mention the Hubot using @ to send it message.

Some issues

HipChat emotions are gone and it's no longer possible to use texts like (tea) or (waiting) to render them directly. Stride seems to have a new syntax using :tea: or :tea, but using this syntax in messages only renders plain text. The automatic parsing of URLs doesn't work any more. Stride only renders plain text for URLs.

© 2023 VividCode