amazon-web-servicesaws-lambdachatbotamazon-lex

Provide AWS Lex response in Hyperlink format


While creating a chatbot using AWS Lex, I would like to provide the response in hyperlink format. But I don't want to use Response card in this case. As per the AWS Lex docs, I knew that hyperlinks can't be given directly in responses. Am new to Lamda functions and tried with the following.

exports.handler = (event, context, callback) => {
    callback(null, {
        "dialogAction": {
            "type": "Close",
            "fulfillmentState": "Fulfilled",
            "message": {
                "contentType": "CustomPayload",
                "content": "my link"
            }
        }
    });
};

but still am getting the result in text format. Am even okay with any other approaches.


Solution

  • You can send URL's (no HTML tags) in the response as a normal message. But how that URL is displayed to the user depends on the channel you are using and their output formatting of that message.

    I know that Facebook Messenger will automatically change a URL string to be a link. Most of the other channels probably do too. But the Lex Test Chat will not.

    For testing this sort of thing, it is best to do it in the actual channel your Lex bot will use because a lot of formatting like this works in the actual channel but does not work in the Test Chat.