{"action":"closed","issue":{"url":"https://api.github.com/repos/localytics/lambda-slack-router/issues/26","repository_url":"https://api.github.com/repos/localytics/lambda-slack-router","labels_url":"https://api.github.com/repos/localytics/lambda-slack-router/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/localytics/lambda-slack-router/issues/26/comments","events_url":"https://api.github.com/repos/localytics/lambda-slack-router/issues/26/events","html_url":"https://github.com/localytics/lambda-slack-router/issues/26","id":152767635,"number":26,"title":"Remove token check from SlackBot Router","user":{"login":"franz-josef-kaiser","id":387666,"avatar_url":"https://avatars.githubusercontent.com/u/387666?v=3","gravatar_id":"","url":"https://api.github.com/users/franz-josef-kaiser","html_url":"https://github.com/franz-josef-kaiser","followers_url":"https://api.github.com/users/franz-josef-kaiser/followers","following_url":"https://api.github.com/users/franz-josef-kaiser/following{/other_user}","gists_url":"https://api.github.com/users/franz-josef-kaiser/gists{/gist_id}","starred_url":"https://api.github.com/users/franz-josef-kaiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franz-josef-kaiser/subscriptions","organizations_url":"https://api.github.com/users/franz-josef-kaiser/orgs","repos_url":"https://api.github.com/users/franz-josef-kaiser/repos","events_url":"https://api.github.com/users/franz-josef-kaiser/events{/privacy}","received_events_url":"https://api.github.com/users/franz-josef-kaiser/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-03T13:02:40Z","updated_at":"2016-05-03T14:24:35Z","closed_at":"2016-05-03T14:24:35Z","body":"Currently the [`buildRouter()`](https://github.com/localytics/lambda-slack-router/blob/987a4a9f0a3845bf95ee7c7eedd0f51424153677/index.js#L154-L156) function checks the token from inside the config against the token from the payload:\r\n\r\n```js\r\nif (!body.token || body.token !== token) {\r\n    return context.fail('Invalid Slack token');\r\n}\r\n```\r\n\r\nThis removes the possibility to use the bot in multiple Slack teams. Currently I work around it like this in my main functions `handler.js` file:\r\n\r\n```js\r\nvar router = function() {\r\n\treturn function( event, context ) {\r\n\t\tvar body    = qs.parse( event.body );\r\n\t\tvar command = this.findCommand( body.text );\r\n\r\n\t\tevent.args = command.args;\r\n\t\treturn this.callCommand( command.commandName, event, context.done );\r\n\t}.bind( slackBot );\r\n};\r\nmodule.exports.handler = router();\r\n```\r\n\r\nThere should be a change to how the router works to enable a multi-team usage for bots/commands."}}