Microsoft Teams 的自定义机器人收到 "BotAuthenticator failed to authenticate incoming request!" 错误

Custom Bot for Microsoft Teams getting "BotAuthenticator failed to authenticate incoming request!" error

我正在使用 Bot Framework 为 Microsoft 团队制作自定义机器人。我目前在本地托管机器人并通过 ngrok 进行隧道传输,并且我正在使用 /api/messages URL。我已经用机器人框架注册了机器人,并将机器人句柄放在 BotId 中,应用程序 ID 放在 MiscrosoftAppId 中,应用程序密码放在我的 Web.config 中的 MicrosoftAppPassword 中。 Teams 频道已启用,并且在 Bot Framework 页面上的状态为 "Running"。机器人 运行 在模拟器上,运行 在 Bot Framework 页面上的测试连接上,但它在 Microsoft Teams 中没有 运行。

这是发送到我的机器人的内容:

"type": "message",
"id": "1497620296742",
"timestamp": "2017-06-16T13:38:19.303Z",
"localTimestamp": null,
"serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/",
"channelId": "msteams",
"from": {
    "id": "29:1F9b3IgxC3x5ynp7nVxdSQ0bQ9MNyf7uKDZHrrCfRLyBbjOmdWSY4gyFLuR8cTRFmbXOeDN4f_uI65xSem6M5OA",
    "name": "Ronnei, Evan T"
},
"conversation": {
    "isGroup": true,
    "id": "19:d02a9a4678924803964e6af1d9afc1ab@thread.skype;messageid=1497558943513",
    "name": null
},
"recipient": null,
"textFormat": "plain",
"attachmentLayout": null,
"membersAdded": null,
"membersRemoved": null,
"topicName": null,
"historyDisclosed": null,
"locale": null,
"text": "Test Bot",
"summary": null,
"attachments": [
    {
        "contentType": "text/html",
        "contentUrl": null,
        "content": "<div><span itemscope=\"\" itemtype=\"http://schema.skype.com/Mention\" itemid=\"0\">Test Bot</span></div>",
        "name": null,
        "thumbnailUrl": null
    }
],
"entities": [
    {
        "type": "clientInfo",
        "locale": "en-US",
        "country": "US",
        "platform": "Windows"
    }
],
"channelData": {
    "teamsChannelId": "19:d02a9a4678924803964e6af1d9afc1ab@thread.skype",
    "teamsTeamId": "19:e218343840af4d4397faf47bd3f4eada@thread.skype",
    "channel": {
        "id": "19:d02a9a4678924803964e6af1d9afc1ab@thread.skype"
    },
    "team": {
        "id": "19:e218343840af4d4397faf47bd3f4eada@thread.skype"
    },
    "tenant": {
        "id": "a9691d3f-49e3-46a8-8b23-ddad274d0523"
    }
},
"action": null,
"replyToId": null,
"value": null,
"name": null,
"relatesTo": null

它给我这个 401 未经授权的错误:

BotAuthenticator failed to authenticate incoming request!

就所有这些内容而言,我是一个初学者。我遵循了 Bot Framework 文档中的可用教程,但它仍然不适用于 Teams。我有点被困在这一点上。让我知道是否需要我提供更多信息。

显然我没有足够的声望 post 更多代码...所以这是我的 manifest.json:https://pastebin.com/xK7y2VHX

太好了,您的机器人可以正常工作了。您是否创建了 manifest.json 文件并将其旁加载到 Teams 中?您的清单包含 appID、botID 和关于您的机器人的整体信息。如果没有,这里是packaging instructions。此页面下方有一个页面显示清单架构。如果您已旁加载它但仍有问题,请再次 post!

您附加的清单有几个问题:

  1. bots.botsId 需要成为您的 botframework 机器人的 guid
  2. needsChannelSelectorisNotificationOnly 都应该是布尔值,而不是字符串(例如 "needsChannelSelector": false)

(packageName 不是阻塞元素,但如果适用,理想情况下应该是反向域名表示法中的唯一字符串。)

您还可以与我们的简单机器人程序包 here and make sure you review the packaging and sideloading 说明进行比较。