Mendhak
Mendhak

Reputation: 8775

MS Teams samples not sending messages to listening bot application

When following MS Teams bot samples, I am unable to get any messages from Teams to reach my hosted applications.

Following the MS Teams sample - this is the best way to reproduce the problem.

I ran the project and obtained the endpoint as https://kindly-ash.glitch.me/api/messages.

Registered this on the bot framework site - with Webchat as well as MS Teams.

enter image description here

When sending a message from MS Teams, no requests were reaching the listening Node application.

enter image description here

When sending a message using the bot framework site's webchat, a request does reach the listening Node application, but errors out.

(node:648) UnhandledPromiseRejectionWarning: Error: Request to 'https://state.botframework.com/v3/botstate/webchat/conversations/873ec470c2fe4cf687c186d31c2b17f4/users/873ec470c2fe4cf687c186d31c2b17f4' failed: [405] Method Not Allowed

    at Request._callback (/app/node_modules/botbuilder/lib/bots/ChatConnector.js:523:46)

    at Request.self.callback (/app/node_modules/request/request.js:188:22)

    at emitTwo (events.js:126:13)

    at Request.emit (events.js:214:7)

    at Request.<anonymous> (/app/node_modules/request/request.js:1171:10)

    at emitOne (events.js:116:13)

    at Request.emit (events.js:211:7)

    at IncomingMessage.<anonymous> (/app/node_modules/request/request.js:1091:12)

    at Object.onceWrapper (events.js:313:30)

    at emitNone (events.js:111:20)

(node:648) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:648) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

In addition to the above, I have tried these samples locally and exposing via ngrok, I've also tried hosting on my own servers. I have also tried deleting and recreating bots, removing and re-adding channels.

When testing directly via the Bot Framework Emulator, the message is always received.

I'm unable to tell if MS Teams is not sending requests out, or the Bot Framework site is at fault. Can anyone tell me where I may be missing something in the setup work?

Upvotes: 0

Views: 581

Answers (2)

Bill Bliss - MSFT
Bill Bliss - MSFT

Reputation: 3581

Try again - we think we've fixed the problem.

Upvotes: 2

Wajeed Shaikh
Wajeed Shaikh

Reputation: 3158

This is happening because Bot State Service is deprecated. For testing you could use In Memory Storage. Please update code in src/Bot.ts inside constructor to set In Memory Storage like this:

constructor(private _connector: teams.TeamsChatConnector,private botSettings: any,) {
    super(_connector, botSettings);
    this.set("persistConversationData", true);

    var inMemoryStorage = new builder.MemoryBotStorage();    
    this.set('storage', inMemoryStorage);  

Please have a look at documentation on how to Manage state data. For production please use Custom Data Storage.

Upvotes: 1

Related Questions