如何检查是否从ms团队卸载了bot/应用程序?



我有一个机器人应用程序,我安装在我的团队,使用团队范围。现在,当这个应用程序从团队卸载时,是否有任何事件我可以得到/监控?

我正在浏览微软文档,并试图遵循一段代码。当bot或成员被移除时,onTeamsMembersRemovedEvent被调用。

export class MyBot extends TeamsActivityHandler {
constructor() {
super();
this.onTeamsMembersRemovedEvent(async (membersRemoved: ChannelAccount[], teamInfo: TeamInfo, turnContext: TurnContext, next: () => Promise<void>): Promise<void> => {
let removedMembers: string = '';
console.log(JSON.stringify(membersRemoved));
membersRemoved.forEach((account) => {
removedMembers += account.id + ' ';
});
const name = !teamInfo ? 'not in team' : teamInfo.name;
const card = CardFactory.heroCard('Account Removed', `${removedMembers} removed from ${teamInfo.name}.`);
const message = MessageFactory.attachment(card);
await turnContext.sendActivity(message);
await next();
});
}
}

但是对于我来说,当我删除bot应用程序时,我没有收到此事件。我通过选择卸载手动从应用程序中删除bot应用程序。

通过导航到更多选项卸载应用程序>管理团队;应用程序在卸载,teamMemberRemoved事件被触发并得到正确的响应。

{
"membersRemoved": [
{
"id": "28:aXXXXX04-e293-447c-951f-6a6971b3b66b"
}
],
"type": "conversationUpdate",
"timestamp": "2021-10-19T15:24:45.9499395Z",
"id": "f:e0d2c276-XXXXX-5d74-73ad-3c67b9b0ae4f",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/amer/",
"from": {
"id": "29:1qanOqiaR5gWE-aWoYPdYjB--mUmmVQFGddHxyb37WXc4FI-eD62pSxBJYoXXXXXeGyFlpiTzRd-fTCiBmNbeuQg",
"aadObjectId": "XXXXXc4d0-XXXXX-4154-a85f-a89cd77aefa8"
},
"conversation": {
"isGroup": true,
"conversationType": "channel",
"tenantId": "3XXXXXef-XXXXX-4d60-XXXXX-0aXXXXX693df",
"id": "19:XXXXX53a099498f9e08679e58f1f7fc@thread.tacv2"
},
"recipient": {
"id": "28:aXXXXX-e293-XXXXX-951f-6a6971b3b66b",
"name": "XXXXX"
},
"channelData": {
"team": {
"aadGroupId": "XXXXXf3-fa01-XXXXX-bb62-201225dce9e4",
"name": "XXXXX",
"id": "19:XXXXX099498f9e08679eXXXXXf7fc@thread.tacv2"
},
"eventType": "teamMemberRemoved",
"tenant": {
"id": "36a708ef-XXXX-4d60-9de0-XXXXXXdf"
}
}}

相关内容

  • 没有找到相关文章

最新更新