Chatroom Integration Plugin (discourse-chat-integration)

Summary: Integrate your chat system of choice with Discourse

:link: GitHub: https://github.com/discourse/discourse-chat-integration
:arrow_right: Install: Follow the plugin installation guide.

Features

Continuing from Common event system for chatrooms

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

Configuration

  1. In your site settings, check chat_integration_enabled is :heavy_check_mark:
  2. Click on one of the providers below to see provider-specific setup instructions
  3. 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:
Google Chat :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 :white_check_mark:
Basecamp Docs
IRC Cloud Docs
Flock Docs
Webex :white_check_mark:

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, create per-topic threads on the chat provider (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.

To load a transcript for a Slack thread, you can use /discourse post thread {url}, where {url} is the permalink of the first message in the thread. For example:

/discourse post thread https://<slackname>.slack.com/archives/C6029G78F/p1522952993000017

Alternatively, you can use /discourse post with a thread-specific permalink like this:

/discourse post https://foo.slack.com/archives/G49KKS6AX/p1523062012000911?thread_ts=1523091738.000088&cid=G49KKS6AC

In both cases the “first/last message” UI is skipped - the entire thread is included in the transcript.

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.

CHANGELOG

TODO

89 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
Set up Microsoft Teams notifications using the discourse-chat-integration plugin
Set up Google Chat notifications using the discourse-chat-integration plugin
Telegram Notifications Plugin (discourse-telegram-notifications)
Set up Webex notifications using the discourse-chat-integration plugin
Will Rocket Chat and others get transcript posting?
Telegram Notifications Plugin (discourse-telegram-notifications)
iOS Mobile App Notifications
Dynamic of community with a chat and discourse page
Tool for Tossing out Notifications via Discord
Set up Slack notifications using the discourse-chat-integration plugin
Set up Telegram integration using the discourse-chat-integration plugin
Comment on a question instead of answering it
Auto Post New Topics to Social Media
Configuring Slack for Discourse Slack Plugin
Set up Discord notifications using the discourse-chat-integration plugin
Discourse-official-slack: no error message after failed post to slack
Steam Authentication & Integration
Checking if post or thread - Ruby
Can you enable a plugin that integrates slack and discourse?
Adding a new provider to discourse-chat-integration
Help configuring Slack Discourse plugin
How can I beef up Discourse notifications?
HipChat Integration
Telegram Notifications Plugin (discourse-telegram-notifications)
Notifications integration for Facebook and Twitter
Plugin for auto posting to social media?
Two-way sync chat with discourse
Set up Slack notifications using the discourse-chat-integration plugin
[PAID] Turning Discourse Forum to Messenger App
Contributor Interviews – David Taylor
Send summary of new posts to chat instead of every post update
Discourse as a Virtual Conference Platform
Discourse to Discord bot possible?
Configuring Discord Login for Discourse
Writing messages from Slack to Discourse
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
Advice for getting my little game dev community "out there?"
Can Discourse Integrate with Free Slack?
Discourse & Drift Chatbot
IFTTT Chat Integration Plugin - curious on status
Moving from Slack to Discourse
Help configuring Slack Discourse plugin
Advice for starting a community site for housing cooperative
More Like WhatsApp for addiction support?
Slack to Discourse
Optionally threading posts to parent topic in slack integration
Optionally threading posts to parent topic in slack integration
Set up Telegram integration using the discourse-chat-integration plugin
Groupme Provider Integration for discourse-chat-integration plugin
Is it possible to use live chat software with Discourse?
Feed Discourse posts into my Discord server?
Twilio - for SMS notifications to users - Anyone Else Interested?
Discourse vs Salesforce Community vs Slack
Discourse for Teams is here!
Adding a confirmation to particular tag groups and @mentions
Best chat integration for a Forum breakout
Babble - A Chat Plugin

Could you share an example screenshot of this?

We don’t have it on our roadmap at the moment, but it would certainly be #pr-welcome if someone from the community would like to develop the feature :slight_smile:

5 Likes

Is it possible to use this plugin to integrate with signal.org? I’m guessing that it may not be possible due to the mobile number associated identities and the lack of a direct web service with Signal, but would love to be corrected!

6 Likes

Yeah I think the lack of a central web API would make this quite difficult. I see there are things like GitHub - AsamK/signal-cli: signal-cli provides a commandline and dbus interface for signalapp/libsignal-service-java, which could possibly be used.

Another option is to try and go via Matrix: https://matrix.org/docs/projects/bridge/mautrix-signal

8 Likes

Sorry, I completely missed the reference to ‘thread’ in your question :facepalm:

We do have support for threads, but it wasn’t documented in this topic. I just added this section to the OP here - please let me know if works as described for you:

6 Likes

Yeah I’m afraid that’s not currently possible. Please do feel free to create a #feature topic with the #chat-integration tag. I can definitely see this being a useful feature for some communities.

5 Likes

Hello,

I have an issue with this plugin. When I click to test the integration withs Discord or Telgram (same issue both) :
I must chose the message test to send
But the round turn and seems to stuck

Any idea ?

1 Like

Are you seeing any error messages in the browser console or in /logs on your site?

2 Likes

I am getting the error /discourse failed with the error “dispatch_unknown_error” when posting the message from slack to our discourse application. Following the above post, i have added the api link and necesssary token. Is there a way to debug or analyse what is the reason of this error

Is that the error Slack is showing, or from /logs on your Discourse site? If there’s an error on /logs that might give us more details, including a stack trace. Otherwise, it might be something misconfigured.

1 Like

Everyone Please help!!!
How can I Change Telegram template from first image to second template?
The second template is look like we paste link in telegram directly and it fetch image as thumbnial , Topic title and link.

Screenshot 2021-04-09 00.13.51

Screenshot 2021-04-09 00.11.42