Use microsoft botbuilder in meteor server

is it possible to use ms botbuilder (https://github.com/Microsoft/BotBuilder/) in meteor directly?

usually botbuilder uses restify:

const server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function () {
  console.log('%s listening to %s', server.name, server.url);
});

const connector = new builder.ChatConnector({
  appId: process.env.MICROSOFT_APP_ID,
  appPassword: process.env.MICROSOFT_APP_PASSWORD,
});

const bot = new builder.UniversalBot(connector);

server.post('/api/messages', connector.listen());

so i tried to replace the last line with:

WebApp.connectHandlers.use('/api/messages', connector.listen());

because connector.listen() returns a function(res, req, next) that could theoretically also be consumed by WebApp.connectHandlers

However, when i do this and access “/api/messages” I get:

undefined:1

SyntaxError: Unexpected end of input
    at Object.parse (native)
    at IncomingMessage.<anonymous> ((...)/bots/ChatConnector.js:50:37)
    at emitNone (events.js:67:13)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:923:12)
    at nextTickCallbackWith2Args (node.js:511:9)
    at process._tickCallback (node.js:425:17)

and when i send an empty post i get:

TypeError: res.status is not a function
1 Like

Did you managed to get it to work?

nope, i started with a simple node app for that. But i would love to use meteor for that :blush:

1 Like