Help configuring Slack Discourse plugin


(Ukiah Smith) #1

I am having no luck when it comes to configuring the Slack integration. I am following the Slack plugin configuration instruction. I am following the instructions exactly. I am only configuring the Incoming Webhook, not the optional Slash Command. The Incoming Webhook is configured to send a private message to my user.

My Discourse setup is set to require authentication to read content on the site.

I am an Admin in the slack I am connecting to.

Plugin version: Most recent from github
Discourse version: v1.9.0.beta3 +27 (current up to date version)

I rebuild the app and I see the configuration options available. I copy in the proper values and everything saves.

Once everything is configured nothing happens. I setup a private DM as a notification, I setup a Category to notify a channel, I try the Test Notification. None of these post a message to the Slack. No notification anywhere.

I use the webhook URL and I POST a simple json from the command line using cURL. The cURL command works. It pops up directly as a DM to my slack user.

curl -X POST -H 'Content-type: application/json' -d '{"text": "this is a test yo! from the CLI"}' https://hooks.slack.com/services/{redacted}

I looked in the logs and I saw no errors specific to Slack or the plugins. Where would I look for error logs? The plugin is silent, quiet, no failure notices. How can I make it louder when there is an error?

What am I missing?

Thank you.


#2

Hey there,
Have you set up a filter rule? You can do it at /admin/plugins/slack


(Ukiah Smith) #3

Yes, I tried two filter rules. One that would notify post first to a channel, and a second that would notify my Slack user on any activity. But not both at the same time.

Even if there were no filters, wouldn’t the Test Notification still work?

I deleted the initial filter rule, as the slack had renamed the general channel to general-tech.


(Ukiah Smith) #4

I think I have it working now. I did two things:

  • Installed the Slackdoor plugin
  • Created an All Categories filter rule

I tested by disabling Slackdoor and notifications did not appear to work.

Why would Slackdoor help this? I thought the Official Slack Plugin was just an outgoing POST connection. It shouldn’t need an Incoming Webhook.


(Dave McClure) #5

That sounds odd to me. Hard to believe, frankly.

But I just tried disabling the Slackdoor plugin on our site and indeed, “Test Notification” from the official Slack plugin does not work until I re-enable to Slackdoor plugin… :confused:


(Jeff Atwood) #6

Well, “slackdoor”, whatever that may be, is not installed on our Discourse dev instance and we definitely get slack messages when new posts are made there.


(Dave McClure) #7

This is the slackdoor plugin.

But… I just tried things again this morning, and I cannot reproduce this issue. While the slackdoor plugin is installed but disabled, notifications from the slack plugin still work when triggered by creating a post and by clicking the “Test Notification” button on the Slack plugin page.

Not sure what was happening last night when I looked first.


(David Taylor) #8

The “test notification” button has some quirks - when you click it, it chooses a random post from your forum to send (could include PMs). Then when it actually tries to send, it checks whether the slack user account is allowed to see the post. If not then it aborts the sending.

Tl;dr: “Test Notifications” won’t always work :facepalm:

(I’ve fixed this in my new implementation)


(Ukiah Smith) #9

So it could be that I got really unlucky in the several times I clicked test?

But I am admin on the Slack, and admin on the Discourse forum. Shouldn’t I have access to everything that way?


(David Taylor) #10

Yes, it could be

It doesn’t matter what you have access to, it matters what the slack_discourse_user has access to. By default it’s the “system” account. Regardless of permissions, the slack plugin will completely refuse to send private messages, so that could be why the test button isn’t working reliably for you.


(Andy at Focallocal) #11

we’re having the same issue. i’ve had one post go through using the ‘test notifications’ button, so it is able to work - but every other post and test has failed to go to our Slack thread


(Andy at Focallocal) #12

it might be related to the tokens. i couldn’t understand where i was supposed to find the token which the how to says i should enter


#13

Same issue here. I even posted test post but it is not being passed to slack.
I’m not using a slackdoor plugin but the official plugin. @UkiahSmith How did you make yours work? Thanks


(David Taylor) #14

My personal recommendation is that you use the new plugin I wrote: Chatroom Integration Plugin (discourse-chat-integration)

It has all the same functionality, and solves a lot of bugs that the existing Slack plugin has.


#15

Hi @david This is awesome. Should I remove the official discourse slack plugin first before integrating yours to remove conflict? Thanks. :slight_smile:


(David Taylor) #16

They should work fine side by side, so it’s up to you. If you have both installed, make sure you don’t get confused with the site settings - the new plugin prefixes all of them with “chat integration”


#17

@david is the chat integration slack access token required? Or just the chat integration slack outbound webhook url?

I’m confused why Slack incoming webhook provides url, outbound webhook provides token but in discourse - outbound is webhook url while inbound is the token.


(David Taylor) #18

Have you tried following the slack-specific setup instructions?

You need either the access token, OR the Webhook URL. I would recommend the access token, because it enables more functionality like posting slack transcripts to Discourse. These instructions walk you through setting up the token, and assigning the correct permissions: