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 (
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.
- 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
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
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 .
Now the plugin supports “slash commands”:
Instructions to enable this feature:
- 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.
- Sign in in the developers page.
- Go here and copy the
personal access token.
- Go to
/admin/site_settings/category/all_results?filter=gitter in your forum and paste the personal access token.
- Enable the gitter bot.
- Set the gitter usernames that should be allowed to execute gitter commands.
Now there will be a bot assisting the commands sent to each of the rooms for which there is an integration created in
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.
Please feel free to PM me about this - we can adjust the chat-integration structure to make it work better if needed
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-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