Hyperlink In Response Card Button In Amazon Lex
Solution 1:
As of now you cannot do that using the buttons. The buttons have two parameters text
and value
. When you click on a button, the value
of button is sent to the servers and the text
is appended to the chat. So it will just send the value back to Lex
but cannot open function as hyperlink.
However you can use image in the response card for the same functionality. imageUrl
is the url of the image to be displayed, and attachmentLinkUrl
is the url which you want to open. So I would suggest you to remove buttons and use an image of map to be shown and provide your hyperlink in attachmentLinkUrl
.
Also, if you want to show multiple hyperlink, you can show multiple cards (upto 10) in a single responseCard
.
Below is a sample code:
return {
'dialogAction': {
'type': 'Close',
'fulfillmentState': 'Fulfilled',
'message': {
'contentType': 'PlainText',
'content': message
},
'responseCard': {
'version': '0',
'contentType': 'application/vnd.amazonaws.card.generic',
'genericAttachments': [
{
'title': 'Here is a list of hospitals',
'subTitle': 'Below is a map',
'attachmentLinkUrl': 'https://www.google.com/maps/search/?api=1&query=nearby+hospitals','imageUrl': 'https://images.sftcdn.net/images/t_optimized,f_auto/p/95612986-96d5-11e6-af7c-00163ec9f5fa/3771854867/google-maps-screenshot.png'
},
{
'title': 'Here is a list of medical shops',
'subTitle': 'Below is a map',
'attachmentLinkUrl': 'https://www.google.com/maps/search/?api=1&query=nearby+medical+shops','imageUrl': 'https://images.sftcdn.net/images/t_optimized,f_auto/p/95612986-96d5-11e6-af7c-00163ec9f5fa/3771854867/google-maps-screenshot.png'
}
]
}
}
}
You can check this as well for details about response cards. Hope it helps.
Post a Comment for "Hyperlink In Response Card Button In Amazon Lex"