A partial archive of meta.discourse.org as of Tuesday July 18, 2017.

Help configuring Slack Discourse plugin

UkiahSmith

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.

HAWK

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

UkiahSmith

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.

UkiahSmith

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.

mcwumbly

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:

codinghorror

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.

mcwumbly

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

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)

UkiahSmith

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

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.