microsoft / BotFramework-Services

Microsoft Bot Framework Services
Creative Commons Attribution 4.0 International
38 stars 11 forks source link

ChoicePrompt with LG Template and Hero Card style throws error in Telegram Bot #315

Closed deman4ik closed 2 years ago

deman4ik commented 3 years ago

Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Version

4.14.

Describe the bug

While using prompt with style Hero Card and language template, like this

await step.prompt(CHOICE_PROMPT, {
      prompt: ActivityFactory.fromObject(
        this.lgTemplates.generate(
          "ModeOfTransportPrompt",
          undefined,
          step.context.activity.locale
        )
      ),
      choices: ChoiceFactory.toChoices(["Car", "Bus", "Bicycle"]),
      style: 5
    });

throws

Error:DialogContextError: Bad Request: can't parse entities: Character '.' is reserved and must be escaped with the preceding '\'

in Telegram but works in Emulator

To Reproduce

Steps to reproduce the behavior:

  1. Clone https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/javascript_nodejs/language-generation/05.a.multi-turn-prompt-with-language-fallback
  2. in https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/javascript_nodejs/language-generation/05.a.multi-turn-prompt-with-language-fallback/dialogs/userProfileDialog.js transportStep method set style to 5 (HeroCard) for prompt options
  3. Run example with Telegram Bot

Expected behavior

Show Message in Telegram Bot with inline buttons like in Emulator Screenshot 2021-08-24 at 14 20 43

Additional context

Works with Emulator but not with Telegram Bot

Tracking Status

Dotnet SDK [TODO]()

Javascript SDK [TODO]()

Python SDK [TODO]()

Java SDK [TODO]()

Samples [TODO]()

Docs [TODO]()

Tools [TODO]()

joshgummersall commented 3 years ago

This error looks like it comes directly from the Telegram API, there are some notes on Markdown escaping in the docs here. I'll transfer this issue over to https://github.com/microsoft/BotFramework-Services.

bwamie commented 2 years ago

@deman4ik This seems to be an issue with markdown. You may be using a lower schema transformation version which doesnt markdown some characters such as a '.' Try selecting a higher version atleast greater than 1.1. You can do this from your bot Configuration settings page as shown in the image below.

image

MichaelHaydenAtMicrosoft commented 2 years ago

@deman4ik - wanting to follow up to see if Edwin's solution resolved your issue. Have you tried the updated version?

MichaelHaydenAtMicrosoft commented 2 years ago

Closing for now. Please update or reopen if additional help is needed.