diff --git a/lib/controllers/gchats/botkit/index.js b/lib/controllers/gchats/botkit/index.js index 522e9d3..56049bb 100644 --- a/lib/controllers/gchats/botkit/index.js +++ b/lib/controllers/gchats/botkit/index.js @@ -1,4 +1,5 @@ -var Botkit = require('@abbott-platform/botkit/lib/CoreBot'); +const Botkit = require('@abbott-platform/botkit/lib/CoreBot'); +const URL = require('url'); function AbbottBot(configuration) { // Create a core botkit bot @@ -70,9 +71,12 @@ function AbbottBot(configuration) { var payload = req.body; + let response_url = URL.parse(decodeURIComponent(req.query.response_url)); + let responseRoom = payload.conversation.name; + let bot = botkit_core.spawn({ botFirendlyName: botkit_core.config.botFirendlyName, - response_url: req.query.response_url, + response_url: `https://dynamite.sandbox.googleapis.com/v1/${responseRoom}/webhooks${response_url.search}`, response: res }); // Receive messages and trigger events from the Events API @@ -107,4 +111,4 @@ function AbbottBot(configuration) { return botkit_core; } -module.exports = AbbottBot; +module.exports = AbbottBot; \ No newline at end of file