MS Teams 示例未向侦听机器人应用程序发送消息
MS Teams samples not sending messages to listening bot application
在跟踪 MS Teams 机器人示例时,我无法从 Teams 获取任何消息来访问我的托管应用程序。
遵循 MS Teams sample - 这是重现问题的最佳方法。
我运行 项目并获得端点为https://kindly-ash.glitch.me/api/messages
。
已在 bot framework site 上注册 - 使用 Webchat 和 MS Teams。
从 MS Teams 发送消息时,没有请求到达侦听节点应用程序。
使用 bot framework site's webchat 发送消息时,请求确实到达了侦听节点应用程序,但出错了。
(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.
除了上述之外,我还在本地尝试了这些示例并通过 ngrok 公开,我还尝试过在我自己的服务器上托管。我也试过删除和重新创建机器人,删除和重新添加频道。
直接通过 Bot Framework Emulator 进行测试时,总是会收到消息。
我无法判断是 MS Teams 没有发送请求,还是 Bot Framework 站点有问题。谁能告诉我在设置工作中我可能遗漏了什么?
这是因为 Bot State Service is deprecated. For testing you could use In Memory Storage。
请更新构造函数内部 src/Bot.ts 中的代码以像这样设置 In Memory Storage:
constructor(private _connector: teams.TeamsChatConnector,private botSettings: any,) {
super(_connector, botSettings);
this.set("persistConversationData", true);
var inMemoryStorage = new builder.MemoryBotStorage();
this.set('storage', inMemoryStorage);
请查看有关如何 Manage state data. For production please use Custom Data Storage 的文档。
再试一次 - 我们认为我们已经解决了问题。
在跟踪 MS Teams 机器人示例时,我无法从 Teams 获取任何消息来访问我的托管应用程序。
遵循 MS Teams sample - 这是重现问题的最佳方法。
我运行 项目并获得端点为https://kindly-ash.glitch.me/api/messages
。
已在 bot framework site 上注册 - 使用 Webchat 和 MS Teams。
从 MS Teams 发送消息时,没有请求到达侦听节点应用程序。
使用 bot framework site's webchat 发送消息时,请求确实到达了侦听节点应用程序,但出错了。
(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.
除了上述之外,我还在本地尝试了这些示例并通过 ngrok 公开,我还尝试过在我自己的服务器上托管。我也试过删除和重新创建机器人,删除和重新添加频道。
直接通过 Bot Framework Emulator 进行测试时,总是会收到消息。
我无法判断是 MS Teams 没有发送请求,还是 Bot Framework 站点有问题。谁能告诉我在设置工作中我可能遗漏了什么?
这是因为 Bot State Service is deprecated. For testing you could use In Memory Storage。 请更新构造函数内部 src/Bot.ts 中的代码以像这样设置 In Memory Storage:
constructor(private _connector: teams.TeamsChatConnector,private botSettings: any,) {
super(_connector, botSettings);
this.set("persistConversationData", true);
var inMemoryStorage = new builder.MemoryBotStorage();
this.set('storage', inMemoryStorage);
请查看有关如何 Manage state data. For production please use Custom Data Storage 的文档。
再试一次 - 我们认为我们已经解决了问题。