message: move slash commands and incming webhooks into ingestion pipeline
diff: @@ -431,37 +431,32 @@ function Slackbot(configuration) {
  next();
  });
  - function handleSlashCommand(payload, bot) {
  - var message = {};
  + slack_botkit.middleware.normalize.use(function handleSlashCommand(bot, message, next) {
  - for (var key in payload) {
  - message[key] = payload[key];
  - }
  + if (message.command) {
  - // let's normalize some of these fields to match the rtm message format
  message.user = message.user_id;
  message.channel = message.channel_id;
  message.type = 'slash_command';
  -
  - slack_botkit.receiveMessage(bot, message);
  }
  - function handleOutgoingWebhook(payload, bot) {
  - var message = {};
  + next();
  - for (var key in payload) {
  - message[key] = payload[key];
  - }
  + });
  - // let's normalize some of these fields to match the rtm message format
  + slack_botkit.middleware.normalize.use(function handleOutgoingWebhook(bot, message, next) {
  +
  + if (message.trigger_word) {
  message.user = message.user_id;
  message.channel = message.channel_id;
  message.type = 'outgoing_webhook';
  + }
  +
  + next();
  + });
  - slack_botkit.receiveMessage(bot, message);
  - };
  /* End of webhook handler functions
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  