microsoft / botbuilder-dotnet

Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
https://github.com/Microsoft/botframework
MIT License
871 stars 478 forks source link

AttachmentPrompt does not work in OmniChannel Implemtation .Net #4035

Closed MichaelStark-Reactor closed 4 years ago

MichaelStark-Reactor commented 4 years ago

Version

version 4.7.1

Describe the bug

When using a Prompt in Waterfall step to have the user attach an image we are using the AttachmentPrompt. In WebChat and emulator this work fine. When running it in the OmniChannel or D365 it never leaves the Prompt. No matter what the user upload it returns to the prompt.
The OnContinueDialogAsync event is triggered and I can examine the attachment list and I see my attachment. The following step in the waterfall is not triggered. The user is prompted with the text of the prompt again.

To Reproduce

Steps to reproduce the behavior:

  1. Create a Dialog with this step
     private async Task<DialogTurnResult> PictureStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
                var promptOptions = new PromptOptions
                {
                    Prompt = MessageFactory.Text("Attach a profile picture (or type any message to skip).")
                };
                return await stepContext.PromptAsync(nameof(AttachmentPrompt), promptOptions, cancellationToken);
        }
  1. Followed by a step that looks for the attachment.
  private async Task<DialogTurnResult> ConfirmStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var attchments = ((IList<Attachment>)stepContext.Result)?.ToList();
            var attchment = ((IList<Attachment>)stepContext.Result)?.LastOrDefault();
            state.ImageForAI = attchment;
            return await stepContext.PromptAsync(nameof(ConfirmPrompt), new PromptOptions { Prompt = MessageFactory.Text("We got your image") }, cancellationToken);
        }
  1. Then run the code in the emulator and webchat and the Confirmation step runs.

  2. Deploy and run in OmniChannel and the Confermation step does not run

Expected behavior

I expect the Prompt to return and continue into the next step.

Additional context

Our bot exists as a Skill called by a PVA bot. As such we are limited in the conversation. When the conversation ends it returns control to the PVA. So we need to uset the Prompt mechanism to prompt the use and wait for the file.

[bug]

v-kydela commented 4 years ago

@MichaelStark-Reactor - Thank you for the report. I have a few questions.

  1. Have you tried updating to the latest version of the Bot Builder SDK?
  2. Are you using a specific sample from the samples repo?
  3. Since OmniChannel is not a supported channel included in the documentation, can you link to any documentation you're following in order to reproduce this issue?
MichaelStark-Reactor commented 4 years ago
  1. Updating SDK didn't solve it
  2. In sample we are mimicing the Multistep flow, specifically upload profile image step.
  3. OmniChannel is on top of the MSTeams channel . Is there a method for getting attachment from the teams channel?
v-kydela commented 4 years ago

@MichaelStark-Reactor - Teams is a little tricky when it comes to image attachments, but it is possible. If you're using the prompt sample I'm thinking of, then the attachment prompt portion is specifically disabled for Teams. Would you please link to the sample you're using, and also link to the instructions you've followed to run a bot in OmniChannel as you've described in step 4 of your repro steps?

MichaelStark-Reactor commented 4 years ago

This is part of the process. You will need a D365 tenant. https://docs.microsoft.com/en-us/dynamics365/omnichannel/administrator/configure-bot-virtual-agent

v-kydela commented 4 years ago

@MichaelStark-Reactor - Thank you for the link. I tried your code in Teams and it seems to work okay:

image

We'll need some more information in order to reproduce your problem.

  1. Your picture step says "Attach a profile picture (or type any message to skip)." Does your attachment prompt have a validator? (If you would link the sample you're following, that may help answer the question.)
  2. What are you doing to get to the confirmation step, i.e. are you typing text or attaching a file?
  3. If you're attaching a file, what is the file type?
  4. What type of conversation is it (1:1 or group chat or team channel conversation)?
  5. What happens when you run the bot in Teams while not using Omnichannel?
v-kydela commented 4 years ago

@MichaelStark-Reactor - Are you still working on this?

MichaelStark-Reactor commented 4 years ago

I found a hack. I added logic to grab the image in the OnContinueDialogAsync event then restart the conversation and skip the prompt the second time through.

Now there is an issue with using the same Bot as a Skill inside a PVA and then host the PVA in OmniChannel.

v-kydela commented 4 years ago

@MichaelStark-Reactor - I'm glad you were able to resolve your issue.

If you have any questions about your new issue, we would prefer it if you asked them on Stack Overflow. If you use the botframework tag then my team will see your questions. GitHub issues are best-suited for bugs and feature requests.

You might also consider opening a support ticket through the Azure portal. There is a document explaining how to get help here: https://docs.microsoft.com/en-us/azure/bot-service/bot-service-resources-links-help