naresh_321
naresh_321

Reputation: 149

Render html in lex chatbot

I want to show an anchor tag coming from lambda to lex chatbot but instead of showing as converted HTML its shows as plain text.

This is the output rendered in lex.

Thanks, I have placed your reservation. <a href="www.xyz.com">Visit here</a>

Expected output.

Thanks, I have placed your reservation. visit here

Upvotes: 0

Views: 358

Answers (2)

smac2020
smac2020

Reputation: 10724

The Amazon Lex Service returns values based on the input and has does not have functionality that defines or influences the appearance of the chatbot or how the return value uses HTML.

The appearance of the text and whether it's embedded into HTML is 100 % up the developer whom creates the solution. For example, the developer can influence the appearance using CSS, etc. For example, this is part of the CSS that defines the appearance of the chatbot.

p.lexResponse {
        margin: 4px;
        padding: 4px 10px 4px 10px;
        border-radius: 4px;
        text-align: right;
        min-width: 50%;
        max-width: 85%;
        float: right;
        background-color: #bbf;
        font-style: italic;
     }  

Upvotes: 0

Jay A. Little
Jay A. Little

Reputation: 3287

How the output is rendered depends on your output channel, not on Lex.

For example, to output a link using the Facebook channel, simply write the URL, and facebook will automatically format that URL into a clickable HTML link and display it properly.

If you want to output it exactly as you have it in your example, using your own HTML anchor tags, then you'll have to have some control over the output channel you are using and build the output formatting yourself.

Upvotes: 0

Related Questions