我正在关注this sample以实现Microsoft Graph交互。我设法跟踪并显示了包含验证码的页面,但是Teams SDK似乎不想自动将验证码发布到我的机器人上。
根据示例,我的oauth成功页面上有以下几行
<script src="https://unpkg.com/@microsoft/teams-js@1.4.2/dist/MicrosoftTeams.min.js" integrity="sha384-DcoNUuQTjpW5Sw3msonn/2ojgtNvtC5fCGd5U9RUpL3g1hla1LzHz8I9YIYSXe6q" crossorigin="anonymous"></script>
<script type="text/javascript">
setTimeout(function () {
document.getElementById("instructionText").style.display = "initial";
}, 5000);
microsoftTeams.initialize();
microsoftTeams.authentication.notifySuccess("{{verificationCode}}");
</script>
根据该示例,该漫游器收到名称为signin / verifyState的调用消息,但我没有。登录页面确实关闭了。
关于为什么该页面无法自动将代码通知我的机器人的任何想法?
答案 0 :(得分:0)
抱歉,这花了很长时间。知道了。
因此,问题在于您正在寻找message
活动,但是Teams正在发送invoke
活动,而该活动没有被onMessage
捕获。相反,在您的BotController中,使用类似以下内容的
this.onUnrecognizedActivityType(async (turnContext, next) => {
console.log(`GOT : ${ JSON.stringify(turnContext.activity, null, 2)}`)
});
这将产生:
GOT : {
"name": "signin/verifyState",
"type": "invoke",
"timestamp": "2019-06-07T22:19:53.810Z",
"localTimestamp": "2019-06-07T22:19:53.810Z",
"id": "f:490708197841asdfasdfasdf15",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/amer/",
"from": {
"id": "29:1AvIMwjQc1iBRcFYBe-0opf4YzVU130fNasdjkhfkldjshfjkahgsdfjklasdkjfasdfcS_7MO9DKFFNL6Ow",
"name": "asdfasdfasdfasdf",
"aadObjectId": "asdfasdfasdfasdf"
},
"conversation": {
"conversationType": "personal",
"tenantId": "asdfasdfasdfasdfasd",
"id": "asdfasdfasdfasdf"
},
"recipient": {
"id": "asdfasdfasdfasdf",
"name": "asdfasdfasdfasdf"
},
"entities": [
{
"locale": "en-US",
"country": "US",
"platform": "Windows",
"type": "clientInfo"
}
],
"channelData": {
"tenant": {
"id": "asdfasdfadsfasdf"
},
"source": {
"name": "message"
}
},
"value": {
"state": "asdfasdfasdfasdf"
},
"locale": "en-US"
}