'use strict';

const helpers = require('../../helpers');

module.exports = function outboundMessage() {
  return (req, res) => {
    req.conversation.createOutboundImportMessage(req.importMessageText, req.outboundTemplate)
      .then(() => helpers.sendResponseWithMessage(res, req.conversation.lastOutboundMessage))
      .catch(err => helpers.sendErrorResponse(res, err));
  };
};

@@ -214,16 +214,21 @@
 Template
+, req
 )%0A      

send the req object when calling createAndPostOutboundImportMessage in the import-message/message-outbound middleware