Closed afedotov-align closed 6 days ago
@afedotov-align - The continue_conversation()
method returns void by design. Now, admittedly, I am not as familiar with Python and the Python SDK. However, the architecture of the SDKs were purposefully built to mimic one another. And the JS and C# SDKs definitely return void. The Python SDK should do the same. This is because any received proactive message is being inserted into a conversation which, at that point going forward, is being handled by bot. Essentially, it's a handoff.
There is a possible solution. If you setup a cancel_and_help_dialog
, like is demonstrated in this sample, you can intercept the incoming proactive message. You may be able to capture the activity_id or, at least, infer what it was based off of the generated response. In short, to set this up, you only need to have a way to recognize the message as it comes thru whether that is by the activity's text or some other property.
Try the above and let me know how it works out for you.
@stevkan hey, thanks for checking this. Unfortunately, I don't understand how I can use the example you provided in my case. I have a separate python file / processs, which is not a bot web-server (see example code).
Also I see in C# SDK an example with connector to send to existing conversation which actually returns the info about the result (sorry if I misunderstood this, I'm not into C# )
FYI: Here is my minimal code example
from botbuilder.schema import ConversationReference
from botbuilder.integration.aiohttp import CloudAdapter
CONFIG = DefaultConfig()
SETTINGS = BotFrameworkAdapterSettings(CONFIG.APP_ID, CONFIG.APP_PASSWORD)
reference = ConversationReference(
service_url=CONFIG.SERVICE_URL,
channel_id=CONFIG.CHANNEL_ID,
bot={"id": CONFIG.BOT_ID},
user={"id": azure_user_id},
conversation=ChannelAccount(id=converstation_id),
)
ADAPTER = CloudAdapter(ConfigurationBotFrameworkAuthentication(CONFIG))
activity_id = await ADAPTER.continue_conversation(
reference,
lambda turn_context: turn_context.send_activity(message),
CONFIG.APP_ID,
)
print(activity_id)
@afedotov-align - Thank you for your patience. It looks like this is boiling down to a problem in your code. You are trying to get the activity_id
off of the continue_conversation()
method. However, it's the turn_context.send_activity()
method that actually returns this value. If you update your code so that activity_id
is assigned to send_activity()
, then you should get the value you are looking for.
Try this and let me know how it goes.
Closing due to inactivity.
Version
botbuilder-core==4.16.1
Describe the bug
When making proactive message with
it doesn't return anything, but I need to save activity id to update the message later
To Reproduce
Use sample from https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/python/16.proactive-messages/app.py#L87
When calling wait ADAPTER.continue_conversation save results to var like mentioned above.
Expected behavior
I expect to have activity object to be able to save ID to modify this message later.
Additional context
I can try to put a PR for this