aws-samples / aws-lex-web-ui

Sample Amazon Lex chat bot web interface
Other
734 stars 466 forks source link

Unable to create hyperlinks in intialText #568

Closed s-pakker closed 6 months ago

s-pakker commented 11 months ago

Hello,

I am having trouble creating hyperlinks to the intents in the initialText (lex-web-ui-loader-config) with "AllowSuperDangerousHTMLInMessage": true.

ex: "I’m here to answer your questions about this site. [Account Management] (Account Management) [Login] (Login)

Any help is appreciated.

Thanks!

s-pakker commented 11 months ago

I am trying to replicate the same functionality of a lex button.

ex:
image Onlick it posts the text back to the chat.

bobpskier commented 11 months ago

I believe "initialText" is treated as text only at the present time. One could configure an initialUtterance to send to the lex bot and the bot could generate a response with markdown that contains the desired link.

s-pakker commented 11 months ago

Thanks for clarifying @bobpskier. In the response from the bot, how do we configure hyperlinks to post a text back to the chat? We did try the markdowns [Account Management] (Account Management) but it doesn't respond as hyperlinks.

Appreciate your help on this!

bobpskier commented 11 months ago

@s-pakker The lexwebui will process markdown when supplied as a custom payload or supplied via session attributes via lambda fulfillment handler. See https://github.com/aws-samples/aws-lex-web-ui/tree/master/lex-web-ui#markdown-and-html-support. Response cards can also be used to supply one or more buttons that can be used to send content back to the bot.

s-pakker commented 10 months ago

@bobpskier Thanks again. I have a follow-up question related to initialText. Is there a way to override the initialtext using a lambda hook? I saw an example of site loading the response card (lex buttons) along with the initial text. https://www.guidedogs.org.uk/getting-support/

bobpskier commented 10 months ago

@s-pakker There is no lambda hook to override InitialText. This is provided in the lex-web-ui-loader-config.json response. However, I believe you can set InitialText to an empty string and set WebAppConfBotInitialUtterance to some value (utterance) you want to send to the bot on startup. The intent that matches this utterance could return its own content through a lambda hook wired into lex. This would act as a customized first message from the bot.