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

The update_activity python documentation contains errors and no samples for update_activity #1226

Open
DeanHnter opened this issue Apr 9, 2024 · 8 comments · May be fixed by microsoft/botbuilder-python#2101

Comments

@DeanHnter
Copy link

DeanHnter commented Apr 9, 2024

The current documentation on update_activity for python contains errors and so isnt directly usable without modification, further the referenced example of update_activity is focused on updating a card activity but doesent actually give a example of updating a regular message factory. This would be useful as currently im struggling to find an answer to "error unknown" as a resulting response and it would help to reduce the confusion if the samples were actually functional and demonstrated the API's usage correctly.

# Send initial message
message = await turn_context.send_activity("<Your Message>")
activityId = message.id # Fetch activity id.

# MessageFactory.Text(): Specifies the type of text data in a message attachment.
new_activity = MessageFactory.text("The new text for the activity")
new_activity.id = activity_id

# A method that can participate in update activity events for the current turn.
update_result = await context.update_activity(new_activity)

An error occurred while updating the activity: (ServiceError) Unknown

context seems like it should be referencing turn_context which would be consistent with other examples however as mentioned this sample does not work for me as update_activity always results in a error: unknown. Further the activity_id seems to reference the variable defined previously activityId, so in short this is a confusing example and I cant get the code to function even if i imply that the error is caused by these mistakes i get an ambiguous error unknown message.

@ChetanSharma-msft
Copy link
Collaborator

Hello @DeanHnter - Thanks for raising your query.
Could you please share the doc link that you are following including the sample, if you are referring?
Also, please let us know what exact version you are using for Python?

@DeanHnter
Copy link
Author

Hello @DeanHnter - Thanks for raising your query. Could you please share the doc link that you are following including the sample, if you are referring? Also, please let us know what exact version you are using for Python?

Hi thanks for looking into it. Here is the link to the original document and the python version is 3.11

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

@krishnab333
Copy link

facing the same issue in update activity. any updates ?

@DeanHnter
Copy link
Author

DeanHnter commented May 7, 2024

facing the same issue in update activity. any updates ?

Looks like the referenced ticket isn't addressing the same issue (superficially) here and considering their documentation isnt even updated to explain that its broken, so not sure if we will see a fix soon im expecting that moving to c# implementation would be easier than waiting on a fix at this point.

@Vaibhav-MSFT
Copy link

@DeanHnter , we are actively working on this and will let you know the updates.

@Vaibhav-MSFT
Copy link

Vaibhav-MSFT commented May 15, 2024

Hello @DeanHnter ,
We got an update from the sample team that using below code we will be able to update regular message and also the adaptive card.

message = await turn_context.send_activity("")
activityId = message.id # Fetch activity id.

new_activity = MessageFactory.text("The new text for the activity")
new_activity.id = activity_id

update_result = await context.update_activity(new_activity)

@DeanHnter
Copy link
Author

Hello @DeanHnter ,
We got an update from the sample team that using below code we will be able to update regular message and also the adaptive card.

message = await turn_context.send_activity("")
activityId = message.id # Fetch activity id.

new_activity = MessageFactory.text("The new text for the activity")
new_activity.id = activity_id

update_result = await context.update_activity(new_activity)

Hi thank you for the feedback. Unfortunately the problem hasn't been addressed in any direction.

  1. I update the packages and fixed the code provided, and I still received an unknown error response as outlined in my original issue.
  2. The sample provided as outlined in my original response still won't work and will never work. It contains obvious errors that even the worst AI or even IDE could point out yet apparently the sample team cannot even detect. It's very clear either activity_id should actually be the variable activityId or there is another variable that isn't clearly outlined at play in this example.

I cannot recommend anyone actually use this library until the basic functionality actually works and samples that are coherent are produced, it makes no sense that this is the response.

@Vaibhav-MSFT
Copy link

@DeanHnter ,
We will again look into this on priority basis and let you know the updates asap.

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

Successfully merging a pull request may close this issue.

4 participants