Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Teams UpdateActivity events difference when you test in newly created 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.

The update we are trying with UpdateActivityAsync, return NotFound.

After some troubleshooting, I noticed the following:

  1. The new team has a different name: 19:[email protected] as opposed to 19:[email protected].
  2. When I use an older team, it works as expected.
  3. When I update the activity with text only (so no adaptive card as attachment) it will always update as expected.
  4. After an update with a text, we are able to update with an adaptive card ONCE. After one update with an adaptive card, any subsequent updates with adaptive cards will return NotFound.
  5. So, as a workaround, I now first update with text and immediately after that I send the update with the card. Which is a bad UI thing (flickering) but it works for now.

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.

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

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

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:

Operation returned an invalid status code '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. 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). Normal Azure tenant (no preview/trial)

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

like image 272
user1515791 Avatar asked Feb 25 '20 10:02

user1515791


People also ask

Which of the following event in the life cycle of Microsoft teams is invoked when a bot is added to a team?

The conversationUpdate event with the membersAdded object in the payload is sent when either a bot is added to a team or a new user is added to a team where a bot has been added.

How long can a Microsoft teams live event last?

Teams live events Event support for up to 20,000 attendees. 50 events can be hosted simultaneously across a tenant. Event duration of 16 hours per broadcast.

How much bandwidth does Teams live event use?

Teams is always conservative on bandwidth utilization and can deliver HD video quality in under 1.5Mbps.


1 Answers

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.

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

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

like image 193
Trinetra-MSFT Avatar answered Oct 18 '22 09:10

Trinetra-MSFT