question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bot Framework updating Teams activity with empty content

See original GitHub issue

Github issues should be used for bugs and feature requests. Use Stack Overflow for general “how-to” questions.

Versions

What package version of the SDK are you using. 4.8.0 What nodejs version are you using 10.15.3 What browser version are you using Google Chrome What os are you using Windows

Describe the bug

I am experimenting some strange behaviour between a bot and ms teams.

Basically the bot sends me an Adaptive Card and when I interact again the bot will update that last message holding that card with the text “I got updated!”.

Inside ms teams (both windows desktop and web) the messages gets updated indicating “Updated” but with an empty content. This content is not filled until I change the chat and come back.

I can’t tell if this is an expected behaviour or if I’m making some kind of mistake.

To Reproduce

This is a simplified example of the code:

"dependencies": {
        "adaptivecards": "^2.1.0",
        "axios": "^0.21.0",
        "botbuilder": "~4.8.0",
        "dotenv": "^8.2.0",
        "restify": "~8.4.0",
        "(...)":"(...)"
}
const adapter = new BotFrameworkAdapter({...});

adapter.onTurnError = onTurnErrorHandler;

const myBot = new EchoBot();

static processActivity(req, res) {
    adapter.processActivity(req, res, async context => {
        // Route to main dialog.
        await myBot.run(context);
    });
    }
class EchoBot extends ActivityHandler {
    constructor() {
        super();

        this.onMessage(async (context) => {
            await doSomething(context);
        });
    }
}
someCardContent = {...};
lastCardId = undefinded;

async function doSomething(turnContext) {
    if (!lastCardId) {
        { lastCardId } = await turnContext.sendActivity(MessageFactory.attachment(CardFactory.adaptiveCard(someCardContent)));
    } else {
        const newActivity = MessageFactory.text('I got updated!');
        newActivity.id = lastCardId;
        lastCardId = undefinded;
        await turnContext.updateActivity(newActivity)
    }
}

Order as seen in Teams:

1 I interact with the bot (greeting it)

2 The bot sends me a card: Original message image

3a I interact again (pressing the button), the card gets updated (“Actualizado” = “Updated”): Updated Message image

3b In the left panel I can see the message’s new content image

4 I switch conversations and come back to the bot’s chat Updated Message after conversation switch image

Expected behavior

Get the updated message without the need to switch chats.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

I’m not allowed to share the bot’s manifest, it’s for a comany domain.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
stevengumcommented, Jun 28, 2021

@clearab, who’s the best contact person on the Teams team to look into this issue since it seems to deal with how the updated activity is rendered in the Teams clients?

0reactions
clearabcommented, Jun 28, 2021

The refresh section shouldn’t be necessary, just changing the action type to action.execute, then responding to the incoming invoke. I think it is possible to respond to that invoke with text, rather than an adaptive card.

Doesn’t change the core bug though, which is client refresh not getting triggered when updating an activity that contains an adaptive card to just a text message (which is purely a Teams client issue).

I’m going to go ahead and close this, but I’ll continue to monitor the StackOverflow question to make sure the Teams group follows up. (I’m assuming this is a bug, so it may take a bit for a fix). In the interim, I’d definitely just replace the card with a new card if at all possible, rather than a text message.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bot Framework updating Teams activity with empty content
Inside MS Teams (both Windows desktop and web) the messages gets updated indicating "Updated" but with an empty content. This content is not ......
Read more >
Update and delete messages sent from your bot - Teams
In the Bot Framework, every message has its unique activity identifier. Messages can be deleted using the Bot Framework's DeleteActivity method.
Read more >
Bot activity handlers - Teams - Microsoft Learn
The Teams activity handler first checks for any Teams specific events. If no events are found, it then passes them along to the...
Read more >
Handle bot events - Teams | Microsoft Learn
In this module, learn how to handle events in bots for Microsoft Teams, Teams member or bot addition, Team member or bot removed...
Read more >
Conversation events in your Teams bot - Microsoft Learn
Work with conversation events from your Microsoft Teams bot, channel event updates, team member events, and message reaction events with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found