[英]Teams UpdateActivity events difference when you test in newly created teams
We have a Teams bot that posts messages in MS Teams.我们有一个团队机器人,可以在 MS 团队中发布消息。 The first activity of a new conversation is always an adaptive card and once in a while, we update that with a new card.
新对话的第一个活动总是一张自适应卡片,我们偶尔会用一张新卡片更新它。 This worked OK until I made a new Team with this bot.
这一切正常,直到我用这个机器人组建了一个新团队。
The update we are trying with UpdateActivityAsync, return NotFound.我们正在尝试使用 UpdateActivityAsync 进行更新,返回 NotFound。
After some troubleshooting, I noticed the following:经过一些故障排除后,我注意到以下几点:
We use the old bot framework version 3, which I know is not maintained anymore, but as far as I can find, it should still work (no plans to discontinue operation).我们使用旧的 bot 框架版本 3,我知道它不再维护,但据我所知,它应该仍然有效(不打算停止运行)。 Also given the above points (specifically point 4) I would expect it uses the same calls under the hood.
还考虑到上述几点(特别是第 4 点),我希望它在后台使用相同的调用。
So, this works for older teams, but not for a team with @thread.tacv2因此,这适用于较旧的团队,但不适用于使用 @thread.tacv2 的团队
await connector.Conversations.UpdateActivityAsync(
teamsConversationId,
activityId,
(Activity)messageWithCard);
And for teams with @thread.tacv2
we now have to use this对于使用
@thread.tacv2
团队,我们现在必须使用它
var messageWithText = Activity.CreateMessageActivity();
messageWithText.ChannelId = teamsConversationId;
messageWithText.Id = activityId;
messageWithText.Type = ActivityTypes.Message;
messageWithText.Text = "Updated";
await connector.Conversations.UpdateActivityAsync(
teamsConversationId,
activityId,
(Activity)messageWithText);
await connector.Conversations.UpdateActivityAsync(
teamsConversationId,
activityId,
(Activity)messageWithCard);
The exception does not provide too many details:异常没有提供太多细节:
Operation returned an invalid status code 'NotFound'操作返回了无效的状态代码“NotFound”
Conversation not found.未找到对话。
Does anyone know how to avoid this change between teams and allow updates of activity with cards?有谁知道如何避免团队之间的这种变化并允许使用卡片更新活动?
Also (and this is much less important, but I think it's useful to add) I noticed that sometimes (I've seen it twice now) Teams seems unable to render the adaptive card and displays URIObject XML instead, containing error: cards.unsupported.另外(这不太重要,但我认为添加它很有用)我注意到有时(我现在已经看过两次)Teams 似乎无法呈现自适应卡片并显示 URIObject XML,其中包含错误:cards.unsupported . However, if I exit the client and restart it, it renders fine... I have never seen this so far in the old channels.
但是,如果我退出客户端并重新启动它,它会呈现出很好的效果……到目前为止,我从未在旧频道中看到过这种情况。
Teams client version 1.3.00.362 (64-bit) (no dev mode). Teams 客户端版本 1.3.00.362(64 位)(无开发模式)。 Normal Azure tenant (no preview/trial)
普通 Azure 租户(无预览/试用)
EDIT 11/05/2020 It seems that this also happens on teams with the 'old' name (@thread.skype).编辑 11/05/2020 似乎这也发生在具有“旧”名称(@thread.skype)的团队中。 So the '@thread.tacv2' seems unrelated.
所以 '@thread.tacv2' 似乎无关。
We weren't able to find logs at the exact timestamps that you provided, but did find logs for the conversation ids on those dates and see 404s with the same minute and seconds in UTC.我们无法在您提供的确切时间戳处找到日志,但确实在这些日期找到了对话 ID 的日志,并在 UTC 中看到了具有相同分钟和秒数的 404。 We assume the time stamps that were provided are represented in a different timezone.
我们假设提供的时间戳以不同的时区表示。
From the logs we are seeing the following pattern:从日志中,我们看到以下模式:
Bot sends PUT activity with card - 404 returned
Bot sends PUT activity with text - 200 returned
Bot sends PUT activity with card - 200 returned
This looks like the same pattern that you shared in your original post.这看起来与您在原始帖子中分享的模式相同。
There is a scenario that's causing 404s to be returned on PUTS whenever the bot tries to update an existing card message with the exact same card after new messages have been sent to a reply chain有一种情况会导致 404 在 PUTS 上返回,每当机器人尝试在将新消息发送到回复链后使用完全相同的卡片更新现有卡片消息时
These are the repo steps:这些是回购步骤:
Bot send card to reply chain (can be root message or reply message)
Any user sends a message to the chain
Bot attempts to update message with the exact same card
Is it possible that your bot is encountering this?您的机器人是否有可能遇到这种情况? Is there a way to check whether the card your bot is sending in the first PUT request is the same card that is already in the original message
有没有办法检查您的机器人在第一个 PUT 请求中发送的卡片是否与原始消息中已经存在的卡片相同
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.