Gitter integration for Discourse

Hi all!

I have been working on a Gitter integration for Discourse as an alternative service to the Slack plugin and I’d like to share the current state of it.

It’s necessary to create a custom integration in each room in which we want Discourse notifications. Once created, go to /admin/plugins/gitter to register a new integration with the room name (e.g. gitterhq/meta) and the integration webhook url.

As you can see below, the admin interface is pretty similar to the Slack plugin’s, allowing to create filter rules specifying a category and some tags(optional). The main difference is that the filter rules are grouped by room.

Then, when a new post is created it will be notified in the corresponding Gitter rooms’ activity feed. The notifications follow a simple structure (username - topic title - category) due to the size of the activity feed. In addition, the whole notification text will be a link to the post in Discourse.

Here is the repo.

To do

  • Create a PR to the Gitter services library. This will allow us to have an official Discourse integration in Gitter (and stop using a “custom” one) and to perform some customization to the notifications, like setting an icon.
  • Slash commands to manage filter rules from a Gitter room.

In addition, I consider important to mention that the idea is that, in the near future, this plugin makes use of the common event system @david is working on.

Finally, I’m more than happy to receive feedback :slightly_smiling_face:


This looks great! I quite like the way Gitter has the activity stream separate from the message history.

This is definitely a lot clearer than having everything in one list. I will see if I can get something similar in the discourse-chat-integration plugin.

This confirms my fear expectation that some integration providers are going to require more than a simple “string” to define a channel. I will work out a way that discourse-chat-integration can allow different providers to specify “channels” in different ways :thinking:.


Now the plugin supports “slash commands”:

gitter command 1

Instructions to enable this feature:

  1. Create a Gitter account (or you could use an existing one) for your bot and make sure it has access to the rooms you want him to serve in.
  2. Sign in in the developers page.
  3. Go here and copy the personal access token.
  4. Go to /admin/site_settings/category/all_results?filter=gitter in your forum and paste the personal access token.
  5. Enable the gitter bot.
  6. Set the gitter usernames that should be allowed to execute gitter commands.

gitter bot sitesettings

Now there will be a bot assisting the commands sent to each of the rooms for which there is an integration created in /admin/plugins/gitter :slightly_smiling_face:


Hey @jafeth.diazc, this looks good! How production ready is this currently?

The gitter bot is already part of the general chat plugin from David?

Sorry for the late response @rriemann. The plugin is pretty much production ready! I’m currently working on its refactorization into the discourse-chat-integration. The inclusion of the Gitter bot might take a little bit longer since the way it is implemented differs from how the other providers implement slash commands and post transcripts.

1 Like

Please feel free to PM me about this - we can adjust the chat-integration structure to make it work better if needed :slight_smile:


Unfortunately, I’m not being able to find time to keep working on the Gitter integration’s development at most for a couple of months more. Here is an update of the current state of the plugin.

The main task in process is the refactoring of discourse-chat-gitter into discourse-chat-integration. So far, the notifications feature is already integrated (for more info, visit Set up Gitter notifications using the discourse-chat-integration plugin).

The other two features Slash Commands and Transcripts are still to be refactored, but that will happen after having handled a few potential issues found. Those are consequence of the way the Gitter integration implements Slash Commands (due to the lack of an official API for that) which is through a long-running thread to listen to a room’s messages. The issues are:

  • In multi-site installations where multiple discourse sites share the same server process only one of the threads is going to start.
  • In the case of a distributed Discourse forum, a new thread would be created in each server, so one forum is gonna end up with multiple connections to Gitter.

The considered approach for handling them involves creating a rake task and using a template like

to run the rake task as a polling demon for Gitter.

Finally, if any questions, I’d happily answer them asap :slightly_smiling_face: