BotFramework-WebChat icon indicating copy to clipboard operation
BotFramework-WebChat copied to clipboard

Suggested Action with CardAction not working as expected.

Open GreatHavoc opened this issue 1 year ago • 3 comments

Is it an issue related to Adaptive Cards?

No

Is this an accessibility issue?

No

What version of Web Chat are you using?

I am not using latest

Which distribution are you using Web Chat from?

Bundle (webchat.js)

Which hosting environment does this issue primarily affect?

Others or unrelated

Which browsers and platforms do the issue happened?

Others or unrelated

Which area does this issue affect?

Suggested action

Which theme pack does this issue affect?

I did not test it on other theme packs

What is the public URL for the website?

No response

Please describe the bug

Version

Bot Framework Python SDK. botbuilder-core==4.14.8 botbuilder-dialogs==4.14.8 botbuilder-schema==4.14.8 botframework-connector==4.14.8 botframework-streaming==4.14.8

Describe the bug

IDEA: I want to show the option to the user on the bot webchat where he will click to open a link and come back to bot again to continue the flow.

Issue: I am using the prompt to show the user suggested actions and added the action to the choices of the prompt but the issue is after clicking on the suggested action the link opens but i didn't get any response that the button is clicked because of that i can't continue the flow without knowing what isd clicked or selected by the user.

Reference Code: return await step_context.prompt(ChoicePrompt.name,PromptOptions( style=ListStyle.suggested_action, choices=[Choice("Link1"),Choice("Link2"),Choice('Link3',action=CardAction(title="Track Credit Card Application",type="openUrl",value="https://xyz.com")),Choice("Apply Now For Credit Card",action=CardAction(title="xyz link",type="openUrl",value="www.xyz.com",display_text="xyz",text="xyz"))]))

Do you see any errors in console log?

N/A

How to reproduce the issue?

Steps to reproduce the behavior:

  1. Go to 'Open Emulator'
  2. Click on 'Suggested Action with Link'

What do you expect?

After the user clicks the suggested action the display_text will be shown on the chat user response.

What actually happened?

I am using the prompt to show the user suggested actions and added the action to the choices of the prompt but the issue is after clicking on the suggested action the link opens but i didn't get any response that the button is clicked because of that i can't continue the flow without knowing what isd clicked or selected by the user.

Do you have any screenshots or recordings to repro the issue?

Example Suggested Options with OpenLink as CardAction. image After clicking any one of the above: image Nothing is displayed after clicking the button, like it will show selected option in the user side of the chat window.

Adaptive Card JSON

No response

Additional context

No response

GreatHavoc avatar May 30 '24 05:05 GreatHavoc

This is expected behavior for the openUrl action (open the URL and remove the suggested actions). Currently investigating to see if there is a way to override this or somehow combine with a postBack|messageBack|imBack.

More info: https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-add-media-attachments?view=azure-bot-service-4.0&tabs=csharp#process-events-within-rich-cards

dmvtech avatar Jul 15 '24 20:07 dmvtech

I need more information on how to achieve that when I click on the suggested action and open a URL and get a response back that the user clicked on the certain button.

GreatHavoc avatar Jul 18 '24 05:07 GreatHavoc

One approach would be:

Using a postBack | messageBack | imBack that would also display the action selected (for example, 'Credit Card').

Then, when this activity is received by the bot, the bot would have logic to send an event containing the link back to web chat. When web chat receives this (activity) event, coming thru the Web Chat store, the store would then issue an event to a listener set up on the page (i.e., not Web Chat code). When this listener is triggered, it would then open up the URL.

Please see this sample on how to handle incoming events to Web Chat.

dmvtech avatar Jul 18 '24 21:07 dmvtech

Closing as resolved. If assistance is still needed, please comment with pertinent information and we will continue.

dmvtech avatar Sep 17 '24 17:09 dmvtech