botframework-sdk: BotBuilder doesn't work with Microsoft Teams for newly-created bots
The following code just listens for incoming messages and replies with Hello to them. It fails when a message is received from Microsoft Teams when handled by a recently created bot, but works perfectly if I do the same with bots, that were created a month ago.
const fs = require('fs');
const restify = require('restify');
const builder = require('botbuilder');
const server = restify.createServer({
key: fs.readFileSync('../privkey.pem'),
certificate: fs.readFileSync('../cert.pem')
});
server.listen(8889, function () {
console.log('%s listening to %s', server.name, server.url);
});
const connector = new builder.ChatConnector({
appId: '... Bot ID ...',
appPassword: '... Bot Password ...'
});
const bot = new builder.UniversalBot(connector);
server.post('/incoming', connector.listen());
bot.dialog('/', function (session) {
session.send('Hello');
});
For the recently created bots it stops on the following error:
Error: Request to 'https://smba.trafficmanager.net/v3/conversations/19%3A7bccb3fd-ec20-4d39-934d-14be2002c27e_423f5dfe-6118-4a00-ba23-4fafc4b6fc19%40unq.gbl.spaces/activities/1483459651513' failed: [404] Not Found
at Request._callback (/raid/www/sapho.drud.cz/bot/node_modules/botbuilder/lib/bots/ChatConnector.js:415:46)
at Request.self.callback (/raid/www/sapho.drud.cz/bot/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/raid/www/sapho.drud.cz/bot/node_modules/request/request.js:1081:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/raid/www/sapho.drud.cz/bot/node_modules/request/request.js:1001:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
See the detailed log here: https://gist.github.com/drudv/24f82af359f6d8d9313033cfe9c6f947 Also here is a log for the “old” bots, for which it works as expected: https://gist.github.com/drudv/aaf838e1ed2c47d568a0858f748a7b30
I have 5 different bots (2 were registered today, others were created a month ago) and can confirm that it’s reproducible only with these two recently created bots. All of them have correct Messaging endpoint on https://dev.botframework.com/bots page (test connection returns Accepted
) and Microsoft Teams channel is enabled for them.
A few more observations:
-
Old and new bots are handled by different servers. It’s evident from the
User-Agent
header of incoming requests, which isBF-Skype (Microsoft-BotFramework/3.1 +https://botframework.com/ua)
for the old bots andMicrosoft-SkypeBotApi (Microsoft-BotFramework/3.0)
for the recently created bots. -
If a message is sent from the test chat window on https://dev.botframework.com/bots then this code works for all bots. So the issue relates only to Microsoft Teams channel.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (2 by maintainers)
Commits related to this issue
- Updated botbuilder module to fix https://github.com/Microsoft/BotBuilder/issues/1955 — committed to tforster/teams-bot-poc by tforster 7 years ago
Thank you, we have confirmed the issue you described. I will follow up when the fix to the Node.js SDK is published.
@FranckyC, regarding the sign-in card, we’re looking into it. The bug tracking this is here.
I’ll close this specific issue since it was fixed in 3.5.4. Thanks!
@FranckyC I’m getting the same problem with sign-in card on Node.js only. C# works fine. I’ll let the team now.
I found where the problem came from. BotBuilder Node.js SDK produces wrong URL for outgoing messages. When serviceUrl is
https://smba.trafficmanager.net/amer-client-ss.msg
, it uses the following URL to send a response message:which is wrong. It should be: