0
votes

I installed the teams bot from this link https://github.com/OfficeDev/BotBuilder-MicrosoftTeams/tree/master/Node/samples inside of Teams and when I start testing the bot by messaging with "hello" in Teams I get the error below;

The Bot State API is deprecated.  Please refer to https://aka.ms/I6swrh for details on how to replace with your own storage.
Error: GET to 'https://state.botframework.com/v3/botstate/msteams/conversations/19%3A2771d14b8fa2450ca52f97b941c3652f%40thread.skype%3Bmessageid%3D1568300852744' failed: [405] Method Not Allowed
    at Request._callback (/home/me-myself-and-i/workspace/bot/BotBuilder-MicrosoftTeams/Node/samples/node_modules/botbuilder-teams/node_modules/botbuilder/lib/bots/ChatConnector.js:675:46)
    at Request.self.callback (/home/me-myself-and-i/workspace/bot/BotBuilder-MicrosoftTeams/Node/samples/node_modules/request/request.js:185:22)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:459:23)
    at Request.<anonymous> (/home/me-myself-and-i/workspace/bot/BotBuilder-MicrosoftTeams/Node/samples/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:459:23)
    at IncomingMessage.<anonymous> (/home/me-myself-and-i/workspace/bot/BotBuilder-MicrosoftTeams/Node/samples/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:273:13)
    at IncomingMessage.emit (events.js:187:15)

But if I test from the Bot Framework Emulator, everything is fine and I get a response when sending "hello

"enter image description here

Anyone ran into that error?

2

2 Answers

1
votes

The Bot State API was how, back in 2017, bot state was initially managed. It's been deprecated for almost 2 years now. My guess is that the sample you're using is built to call on it for state management, but the API no longer exists.

Additionally, the repo you linked is all v3 bots, and the Bot Framework is currently (as of Sept 2019) in v4.5. I would recommend, if you're getting started using the MS Bot Framework, to not start with v3, as they no longer receive the level of support that v4 bots do.

The Bot Framework team is actually putting in significant effort to integrate v4 with Teams fully. There is a sample currently in their sample repo here, that shows to use OAuth with Teams, for example.

1
votes

I was able to resolve this issue by modifying the /samples/app.js file with the following 2 lines:

connector.resetAllowedTenants();
server.post('/api/v1/bot/messages', connector.listen());
var inMemoryStorage = new builder.MemoryBotStorage();
var bot = new builder.UniversalBot(connector).set('storage', inMemoryStorage);
// create the bot auth agent
var botSigninSettings = {
    baseUrl: 'https://...',
    fbAppClientId: 'fb app id',
    fbAppClientSecret: 'fb app secret',
    fbAppScope: 'public_profile,email,user_friends' // put Facebook access scope
};

The 2 lines that are key in the above code are:

var inMemoryStorage = new builder.MemoryBotStorage();

var bot = new builder.UniversalBot(connector).set('storage', inMemoryStorage);