Bot Framework updating Teams activity with empty content
See original GitHub issueGithub 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
3a I interact again (pressing the button), the card gets updated (“Actualizado” = “Updated”):
Updated Message
3b In the left panel I can see the message’s new content
4 I switch conversations and come back to the bot’s chat
Updated Message after conversation switch
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:
- Created 2 years ago
- Comments:6 (4 by maintainers)
@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?
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.