# Slack command integration broken in official discourse slack plugin

**URL:** https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645
**Category:** Support
**Tags:** chat-integration
**Created:** [April 8, 2017, 3:16pm UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645 "2017-04-08T15:16:53Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [April 8, 2017, 3:16pm UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645/1 "2017-04-08T15:16:53Z")

</div>

I just updated the slack plugin on our instance to the latest version ([compare versions](https://github.com/discourse/discourse-slack-official/compare/e2b330f...master)), and it appears the `/discourse` slack commands are now broken:

Here’s what I see in the logs on our instance:

```plaintext
Started POST "/slack/command" for 52.91.184.228 at 2017-04-08 15:07:59 +0000
Processing by DiscourseSlack::SlackController#command as HTML
  Parameters: {"token"=>"REDACTED", "team_id"=>"REDACTED", "team_domain"=>"mydomain", "channel_id"=>"REDACTED", "channel_name"=>"discourse-test", "user_id"=>"REDACTED", "user_name"=>"someuser", "command"=>"/discourse", "text"=>"help", "response_url"=>"https://hooks.slack.com/commands/FOO/BAR/bazbazbaz"}
Redirected to
Completed 500 Internal Server Error in 5ms (ActiveRecord: 0.0ms)
ActionController::UrlGenerationError (No route matches {:action=>"enter", :controller=>"static"})
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7.1/lib/action_dispatch/journey/formatter.rb:46:in `generate'

```

/cc @vinothkannans @tgxworld

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [April 8, 2017, 3:18pm UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645/2 "2017-04-08T15:18:50Z")

</div>

Is your forum a private forum?

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [April 8, 2017, 3:19pm UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645/3 "2017-04-08T15:19:14Z")

</div>

yes, it is a private forum

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [April 8, 2017, 3:41pm UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645/4 "2017-04-08T15:41:06Z")

</div>

@tgxworld We should skip before\_filter `redirect_to_login_if_required` here?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [April 8, 2017, 4:13pm UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645/5 "2017-04-08T16:13:57Z")

</div>

Yup I think I removed one of the monkey patches. For the `/command` path, we need to skip everything because the only authentication we need to do is to check if the Slack token is valid.

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [April 8, 2017, 4:16pm UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645/6 "2017-04-08T16:16:00Z")

</div>

[my understanding](https://github.com/mcwumbly/discourse-slack-official/commit/2560b493f1fe09d3ac9325aa998c8f590f307810) of @vinothkannans suggestion appears to work in a quick test. I’ll let you do what makes the most sense rather than PR it, though.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [April 8, 2017, 4:21pm UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645/7 "2017-04-08T16:21:33Z")

</div>

> [@vinothkannans](#):
>
> skip before\_filter redirect\_to\_login\_if\_required here?

This is exactly what I’ve done in my Telegram plugin (which is very similar to slack in the way the webhooks work). If there’s a better solution I’d be interested to know!

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [April 10, 2017, 2:23am UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645/8 "2017-04-10T02:23:43Z")

</div>

Thanks for reporting @mcwumbly. I’ve fixed it in

[https://github.com/discourse/discourse-slack-official/commit/c7ce5722f041253ef0a2ee98a74303ac99b4ae8b](https://github.com/discourse/discourse-slack-official/commit/c7ce5722f041253ef0a2ee98a74303ac99b4ae8b)

and added a test case for it. I’ve been involved in refactoring of the plugin but without existing test cases, there is a higher chance of me breaking stuff without knowing. Feel free to report any more bugs that you come across and I’ll get them sorted.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [April 10, 2017, 2:23am UTC](https://meta.discourse.org/t/slack-command-integration-broken-in-official-discourse-slack-plugin/60645/9 "2017-04-10T02:23:46Z")

</div>


