Chatroom Integration Plugin (discourse-chat-integration)

Continuing from Common event system for chatrooms

:speech_balloon: discourse-chat-integration :speech_balloon:

discourse-chat-integration is the product of my Google Summer of Code project with Discourse. It allows sending notifications about new Discourse posts to ‘group chats’ on a number of instant messaging platforms.

It is based on, and aims to supersede, the existing discourse-slack-official plugin.

Notifications can be triggered by new topics, new replies, messages to a group, or mentions of a group. A notification in your instant messaging system will look something like this:

16

Getting Started

  1. (skip this step if you’re hosted by discourse.org)

    Install the plugin by following the Install Plugin instructions. The plugin’s repository address is

    https://github.com/discourse/discourse-chat-integration.git
    
  2. In your site settings, check chat_integration_enabled is :heavy_check_mark:

  3. Click on one of the providers below to see provider-specific setup instructions

  4. For more details, read ‘Configuring Rules’ below

Provider Notifications Slash Commands Post Transcripts Threaded Replies
Slack :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
Telegram :white_check_mark: :white_check_mark:
Discord :white_check_mark:
Mattermost :white_check_mark: :white_check_mark:
Matrix (riot.im) :white_check_mark:
Zulip :white_check_mark:
Rocket.Chat :white_check_mark:
Gitter :white_check_mark:
Flowdock :white_check_mark:
Stride Docs
Microsoft Teams Docs
Basecamp Docs
IRC Cloud Docs
Flock Docs

Terminology

There are three key concepts in discourse-chat-integration: Providers, Channels and Rules

Configuring Rules

In your forum’s admin panel, under Plugins, you should see a Chat Integrations section. Within that there will be tabs for each of your enabled providers:

Rules have a number of options which can be configured:

  • Type:
    • Normal - send notifications based on standard posts on the forum
    • Group Message - send notifications based on private messages which a specified group is a part of
    • Group Mention - send notifications whenever specified group is @mentioned in a standard post on the forum (mentions in private messages are ignored)
  • Filter:
    • All posts with threaded replies - notify for new posts matching this rule, prefer per-topic threads (not available in all integrations)
    • All posts and replies - notify for new posts matching this rule
    • First post only - notify only for new topics matching this rule
    • Mute - prevent notifications matching this rule
  • Category (if type is ‘Normal’)
    • Match posts based on their category. Leave as “(all categories)” to match all posts on the forum
  • Group (if type is ‘Group Message’ or ‘Group Mention’)
    • Specify the group you want to receive notifications for
  • Tags
    • Enter a list of tags to match posts with at least one of the listed tags. Leave blank to match all posts

Multiple rules

When multiple rules match a post, the top-most rule in the user interface is executed. Rules are first sorted according to the criteria:

  1. Group mentions
  2. Group messages
  3. Normal

and then sorted within that by

  1. Mute
  2. All posts and replies
  3. First post only

For example, with the following rules

Filter Category Tags
All posts and replies Mentions of: @team (all tags)
Mute #support (all tags)
First post only #support #unsupported-install
All posts and replies (all categories) (all tags)

Notifications would be triggered for

but not for

Security/Permissions

The site setting “chat integration discourse username” allows you to secure your notifications against leaking private information.

By default the system account is used, which means that there is no restriction on notifications sent. To secure your notifications you should create a non-staff user with appropriate access privileges, and enter its username in the site setting.

Slash Commands

If your provider supports slash commands, you can manage rules from within your chat interface. Each provider varies slightly in syntax, but in general they follow a similar structure. (Note that at this time, only the Slack integration implements threads.)

The commands available are

Posting a transcript

If your provider supports transcript posting, you can post your instant messaging history to discourse. This is currently only supported for the Slack provider. Note: You will need to be using the “Access Token” method of connecting to Slack.

Send /discourse post to see the interface. The plugin will try and “guess” where your current conversation starts, by looking for a gap in the message history of more than 3 minutes.

Alternatively, you can specify a number of posts after the command, or a URL to the first message.

Adding new providers

Option 1: Submit a PR implementing your provider:

Option 2: Use your own plugin:
It is possible for third party plugins to register new “providers”. As an example, I’ve created a provider which sends webhooks to IFTTT. This could be used to automatically publish all posts in a category to facebook… or turn on your light when someone posts in #feature… or feed your fish whenever there’s a new #plugin.

69 Likes
Set up Slack notifications using the discourse-chat-integration plugin
Set up Mattermost notifications using the discourse-chat-integration plugin
Set up Rocket Chat notifications using the discourse-chat-integration plugin
Set up Matrix (riot.im) notifications using the discourse-chat-integration plugin
Set up Gitter notifications using the discourse-chat-integration plugin
Set up Zulip notifications using the discourse-chat-integration plugin
Set up CA Flowdock notifications using the discourse-chat-integration plugin
Telegram Notifications Plugin (discourse-telegram-notifications)
Will Rocket Chat and others get transcript posting?
Telegram Notifications Plugin (discourse-telegram-notifications)
Tool for Tossing out Notifications via Discord
Discourse-official-slack: no error message after failed post to slack
iOS Mobile App Notifications
Configuring Slack for Discourse Slack Plugin
Dynamic of community with a chat and discourse page
Steam Authentication & Integration
Auto Post New Topics to Social Media
Set up Slack notifications using the discourse-chat-integration plugin
How can I beef up Discourse notifications?
Set up Telegram notifications using the discourse-chat-integration plugin
Optionally threading posts to parent topic in slack integration
Help configuring Slack Discourse plugin
About the chat-integration category
Optionally threading posts to parent topic in slack integration
Chat-integration
Set up Slack notifications using the discourse-chat-integration plugin
Can you enable a plugin that integrates slack and discourse?
Chat Integration leaks Babble chats
Configuring Discord Login for Discourse
Send summary of new posts to chat instead of every post update
Discourse as a Virtual Conference Platform
Plugin for auto posting to social media?
Contributor Interviews – David Taylor
Writing messages from Slack to Discourse
Adding a new provider to discourse-chat-integration
Writing messages from Slack to Discourse
Internal Onebox links cause full page reload
Gitter support in chat-integration appears to be missing settings and rules
Notifications integration for Facebook and Twitter
Advice for getting my little game dev community "out there?"
Can Discourse Integrate with Free Slack?
Discourse & Drift Chatbot
Checking if post or thread - Ruby
Help configuring Slack Discourse plugin
Advice for starting a community site for housing cooperative
Set up Discord notifications using the discourse-chat-integration plugin
More Like WhatsApp for addiction support?
Comment on a question instead of answering it
Telegram Notifications Plugin (discourse-telegram-notifications)
HipChat Integration

Please post replies to the #plugin:chat-integration category.

2 Likes

Suggestion, disable display full name on discord message if the forum have “enable names” disabled. I imported users from other forum CMS and has this display name wrong, the plugin needs to check this option, I think.

Example now:
UserName @user
Message

Names disabled:
@user
Message

Hi, I’d like to see a Slack SSO option added to chat integration, especially since this is an option with other integrations such as Twitter, Google, etc. See this info on adding Slack SSO, which is supported on their end.

Here we are, not perfect but the basics are in there for now!

5 Likes

Thanks for the wonderful introduction - I have two questions:

  1. Is it possible to watch a sub-category? E.g. does /discourse watch category/subcategory exist? It seems that the plugin can only follow top-level categories.

  2. I’m also interested in knowing: What happens if a Topic is moved to a new category or has a watched tag added to it? I have just tried the latter, and it didn’t trigger a message on Slack.

Is there any way to set up a channel to share posts that are in the uncategorized Category? I don’t see it coming up but not sure if that’s intentional or if I’m just missing it.

Thanks

As a followup to my previous post, we have /discourse watch foobar switched on. The post being replied to generated a message in Slack, but the reply below it still hasn’t generated a message after 23h.

  • While the documentation for watch says “notify this channel for new topics and new replies”, are replies to topic replies ignored or is this a bug?

Hi, I see it is only possible to setup a outgoing webhook to Rocket.chat, but is there a reason the chat-integration does not allow an incoming webhook as well?

Is there any way to add keyword based rules, i.e. integration will only trigger if a Discourse post contains certain keywords (preferably regex)?

Is someone working on Microsoft Teams service integration for this?

2 Likes

Very good question. Teams is getting really popular and many companies prefer it to Slack.

Is there a way to configure multiples rocketchat destinations on the same Discourse ?

I mean I need to send rules to chat.exemple.com and anothers rules to chat.exemple2.com, is it possible ?

3 Likes

@pokapow If not in this plugin, you could use the self contained Matterbridge. It includes Discourse support here.

edit:
On current tests-pass beta6 with chat-integration. We’re are having trouble accessing tags by group as it seems chat-ingration plugin cannnot find them. Only able to add tags individually.

1 Like

Similar to @pokapow’s question, is there a way to configure this plugin to connect to two Slack workspaces? Alternatively, is there a way to install two copies of this plugin to achieve the same goal?

No, unfortunately this is not possible at the moment.

3 Likes

Does chat-integration support tag groups at all? I cannot get them to work.

What do you mean by ‘support tag groups’? The plugin should support using tags that are in a tag group, if that’s what you’re looking for?

2 Likes

Dear Team!!!

Can I suggest for telegram chat integration?
Normally every posted topic are like this on telegram and it look very difficult to read and unorganized: Imgur: The magic of the Internet

I want to suggest like this:

Yes, tags within groups are not showing up within chat-integration for us on tests-pass beta6.

Also, I’m confused on how to setup any sort of 2-way chat. I understand everything can be outgoing Discourse < Chat. What about receiving replies from Slack back to Discourse? If possible, does this require Babble or any other plugins?

1 Like