Set up Slack notifications using the discourse-chat-integration plugin

You need to use the “OAUTH Token” method of authentication to slack, not the “Webhook” method. The instructions above should walk you through setting up the oauth method.

4 Likes

That did it. I think I broke it by foolishly trying to migrate the settings from the other slack plugin.

One thing I don’t understand is who can use the slack App I created. It is just me? If so, that’s a little sucky. If not, wait, anyone can control what categories get watched? I see “collaborators” in the slack API page. If I add a collaborator can they too control the rules?

Also, it seems that rules established in the Discourse web interface don’t show up in slack if you do a /discourse status. Is that right?

1 Like

When you create slack apps, they are private to you. Only you can edit the settings of the app, and only you can install it onto an organisation. Notice the “Not Distributed” status:
51
You can then install your app onto your Slack organisation. If you have slash commands set up, anyone in that organisation can control the ‘rules’ for any channel they have access to, and so you should make sure to set the chat integration discourse username appropriately.

‘Collaborators’ of the Slack app means that they can edit the app’s settings (things like callback URLs, auth secrets etc.). It has absolutely nothing to do with who can configure ‘rules’ using slash commands.

/discourse status should list all of the rules for the current channel. So if you have set up rules for #general using the discourse admin interface, they should show up when you run /discourse status in #general. If that’s not working, it’s a bug.

7 Likes

Thanks, @david, that’s a huge help. It still seems a bit wild that any slack user can change what Discourse stuff gets posted to a channel, but I suspect that’s because I don’t understand slack.

I think it depends what kind of community you have in Slack. In my mind there are three main scenarios:

  • If any member of the public can join your Slack organisation, Slash commands probably aren’t a good idea. In this case it’s probably easiest to just manage the rules from the discourse admin panel.

  • If you have a fairly open forum, but a closed slack organisation (like I believe the discourse team do), then having slash commands is a nice convenience without any real issue (everyone in slack is trusted).

  • If you have a roughly 1:1 mapping between forum members and slack members (e.g. a corporate environment), it can be useful to allow individuals to manage the rules in their own slack channel. For example, the dev team might want to watch #dev, and the support team #support. Rather than forcing all this to be done by a discourse admin, they can do it themselves with slash commands. I think this is how @mcwumbly uses slack integration.

10 Likes

We’re starting to see some healthy adoption of Slack threads in some channels. I was a big skeptic at first, but as people find good patterns for using them, I can see their value. Does the transcript feature work with threads at all?

4 Likes

That’s great to hear - I was a little skeptical how useful it would be as well, so glad to hear people like it :slight_smile:

Sadly not. I don’t know if the slack API allows loading messages from a specific thread, so we might need to do the filtering on the Discourse end.

8 Likes

Should transcript export work with Direct Messages? I just tried with two different ones and it’ll say Loading the transcript... but nothing happens after that.

2 Likes

I’m getting the same thing, and have checked my access and webhook tokes very carefully. Other things to try?

Also - is it possible to connect Discourse to multiple Slack orgs?

3 Likes

Is this only limited to public channels or can it work with private Slack channels?

UPDATE: I got it to work by treating the private channels as public channels and prefixing its name with #. Slash commands still don’t work on private channels though.

4 Likes

I set up rules for private Slack channels using the Discourse interface and I can receive the post notifications just fine. However, I can’t use slash commands on those private channels. They work just fine on public channels. I was hoping to use /discourse post for the transcripts. Is this a bug?

Yes, it sounds like a bug - I don’t think you are the only one with this problem.

2 Likes

Got it. I thought there was something wrong with my setup. I’m using the latest version of Discourse (v2.0.0.beta5+149).

I’ve just created a PR to fix slash commands in private channels, and add support for transcripts in private channels and direct messages:

https://github.com/discourse/discourse-chat-integration/pull/20

This will require adding two new ‘scopes’ to the slack app, which I’ve added to the #howto above:

  • groups:history
  • im:history
6 Likes

Awesome! Looking forward to testing it :slight_smile: We actually use wisemonk on our Slack as well but we never could trigger it no matter how busy our channels get.

2 Likes

Just noticed that there’s a new version of the chat integration plugin but this fix isn’t included. Will this be merged anytime soon?

From what I can tell on the settings, it doesn’t look like there’s a way to send a notifications as a slack PM… is that possible? Or does that need to be developed/implemented?

You should be able to send notifications as a PM by specifying the channel name as something like @jerdog.

Slash commands do not currently work within private channels or private messages, but will do once this PR is merged by the team:

https://github.com/discourse/discourse-chat-integration/pull/20

3 Likes

Is there any way to configure this so that the messages posted in slack are posted by a Bot (other than slackbot)?