在新创建的团队中进行测试时,团队的UpdateActivity事件有所不同 [英] Teams UpdateActivity events difference when you test in newly created teams

查看:39
本文介绍了在新创建的团队中进行测试时,团队的UpdateActivity事件有所不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个Teams机器人,可以在MS Teams中发布消息.新会话的第一个活动始终是自适应卡片,偶尔我们会使用新卡片进行更新.一切正常,直到我使用该机器人组建了新团队为止.

We have a Teams bot that posts messages in MS Teams. 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.

我们正在尝试使用UpdateActivityAsync进行的更新,返回NotFound.

The update we are trying with UpdateActivityAsync, return NotFound.

经过一些故障排除后,我注意到以下内容:

After some troubleshooting, I noticed the following:

  1. 新团队的名称不同:19:... @ thread.tacv2,而不是19:... @ thread.skype.
  2. 当我使用老团队时,它会按预期工作.
  3. 当我仅使用文本更新活动时(因此没有自适应卡作为附件),它将始终按预期更新.
  4. 使用文本更新后,我们可以使用自适应卡ONCE更新.使用自适应卡进行一次更新后,以后使用自适应卡进行的任何更新都将返回NotFound.
  5. 因此,作为一种解决方法,我现在先使用文本进行更新,然后立即使用卡发送更新.UI不好(闪烁),但现在可以使用.

我们使用的是旧版bot框架版本3,我知道它不再维护了,但是据我所知,它仍然可以正常工作(没有计划终止运行).鉴于上述几点(特别是第4点),我希望它在幕后使用相同的调用.

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). Also given the above points (specifically point 4) I would expect it uses the same calls under the hood.

因此,这适用于年龄较大的团队,但不适用于具有@ thread.tacv2的团队

So, this works for older teams, but not for a team with @thread.tacv2

await connector.Conversations.UpdateActivityAsync(
      teamsConversationId,
      activityId,
      (Activity)messageWithCard);

对于拥有 @ thread.tacv2 的团队,我们现在必须使用此

And for teams with @thread.tacv2 we now have to use this

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:

操作返回了无效的状态码未找到"

未找到对话.

有人知道如何避免团队之间的这种变化,并允许使用卡片更新活动吗?

Does anyone know how to avoid this change between teams and allow updates of activity with cards?

此外(这并不重要,但是我认为添加很有用)我注意到有时(现在我已经看过两次),团队似乎无法呈现自适应卡,而是显示URIObject XML,其中包含错误:卡不受支持.但是,如果我退出客户端并重新启动它,它将呈现良好的效果……到目前为止,我在旧频道中从未见过这种情况.

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. However, if I exit the client and restart it, it renders fine... I have never seen this so far in the old channels.

团队客户端版本1.3.00.362(64位)(无开发人员模式).普通Azure租户(无预览/试用版)

Teams client version 1.3.00.362 (64-bit) (no dev mode). Normal Azure tenant (no preview/trial)

编辑11/05/2020看来在使用旧"名称(@ thread.skype)的团队中也会发生这种情况.因此,"@ thread.tacv2"似乎无关.

EDIT 11/05/2020 It seems that this also happens on teams with the 'old' name (@thread.skype). So the '@thread.tacv2' seems unrelated.

推荐答案

我们无法在您提供的确切时间戳上找到日志,但确实在这些日期找到了会话ID的日志,并看到了具有相同时间戳的404以UTC表示的分钟和秒.我们假定所提供的时间戳记在不同的时区中表示.

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. 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.

在新消息发送到回复链后,当漫游器尝试使用完全相同的卡更新现有卡消息时,有一种情况会导致404在PUTS上返回

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

以下是回购步骤:

 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

您的机器人是否有可能遇到这种情况?有没有办法检查您的机器人在第一个PUT请求中发送的卡是否与原始消息中已经存在的卡相同

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

这篇关于在新创建的团队中进行测试时,团队的UpdateActivity事件有所不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆