# Code review request for \`slackdoor\` plugin

**URL:** <https://meta.discourse.org/t/code-review-request-for-slackdoor-plugin/44253>\
**Category:** Development\
**Created:** [May 14, 2016, 8:28pm UTC](https://meta.discourse.org/t/code-review-request-for-slackdoor-plugin/44253 "2016-05-14T20:28:04Z")\
**Posts on this page:** 1\
**Showing post:** 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:** [May 14, 2016, 8:28pm UTC](https://meta.discourse.org/t/code-review-request-for-slackdoor-plugin/44253/1 "2016-05-14T20:28:05Z")

</div>

Hey there…

I’m looking for some extra pairs of eyes on the plugin I’ve implemented for this feature:

[Allow Slack to unfurl/expand links to “login-required” Discourse instance](https://meta.discourse.org/t/allow-slack-to-unfurl-expand-links-to-login-required-discourse-instance/39547)

Slack posts a request to `yourdomain.com/slackdoor` over https (assuming your site has it enabled) with an `x-www-form-urlencoded` body that includes a token, which is generated on their side when you set up the [outgoing webook](https://api.slack.com/outgoing-webhooks).

```plaintext
token=XXXXXXXXXXXXXXXXXX
team_id=T0001
team_domain=example
channel_id=C2147483705
channel_name=test
timestamp=1355517523.000005
user_id=U2147483697
user_name=Steve
text=googlebot: What is the air-speed velocity of an unladen swallow?
trigger_word=googlebot:

```

The request can’t include an API Key or username, but a required SiteSetting for username determines which user is used to access the topic.

These are all checked `before_filter` methods in the Controller class:

> <https://github.com/mcwumbly/discourse-slackdoor/blob/master/plugin.rb#L38-L49>

In order to bypass the default authentication logic, I have overridden these methods in the plugin’s controller:

> <https://github.com/mcwumbly/discourse-slackdoor/blob/master/plugin.rb#L86-L95>

Check out this file for the full plugin: [discourse-slackdoor/plugin.rb at master · mcwumbly/discourse-slackdoor · GitHub](https://github.com/mcwumbly/discourse-slackdoor/blob/master/plugin.rb)

Please let me know if you see any issues with this approach… Thanks!

---

_[View the full topic](https://meta.discourse.org/t/code-review-request-for-slackdoor-plugin/44253)._
