Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update_activity in messages #2101

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NeeluGeorge
Copy link

@NeeluGeorge NeeluGeorge commented Apr 24, 2024

closes: OfficeDev/Microsoft-Teams-Samples#1226

Description

Python sdk documentation says to pass replyToId as updated_activity.id, but this was not getting passed to the reference created in update_activity

https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/update-and-delete-bot-messages?tabs=python#update-cards

Specific Changes

Added activity.id as the "activity_id" in reference

@NeeluGeorge NeeluGeorge requested a review from a team as a code owner April 24, 2024 15:06
@tracyboehrer
Copy link
Member

@NeeluGeorge What is the reason for this? What is it solving? 'apply_conversation_reference' does this, except conditionally.

@NeeluGeorge
Copy link
Author

@tracyboehrer 'apply_conversation_reference' is using reference.activity_id
But TurnContext.get_conversation_reference(self.activity) called before this will map reference.activity_id with the original activity's id field.
Here we are passing self.activity in TurnContext.get_conversation_reference(self.activity) , not the activity we pass as argument

So our updated activity.id is left unused.This throws invalid ID error

@tracyboehrer
Copy link
Member

@NeeluGeorge Thanks for that. I'll dig a little. I note that the Python get_conversation_reference is different from the DotNet and JS implementations.

@tracyboehrer
Copy link
Member

tracyboehrer commented May 9, 2024

@NeeluGeorge reference.activity_id should be TurnContext.activity.id. That happens in get_conversation_reference. But, Pythons get_conversation_reference is outdated, and that assignment should be conditional, which I will update. So doing this could potentially change that logic.

That doc states the Activity passed to update_activity should have its id set to the incoming activity.reply_to_id. Is there a value for that property?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The update_activity python documentation contains errors and no samples for update_activity
2 participants