Amazon Lex - List - Lambda

Amazon Lex - List - Lambda

With Blahboxit's possible to send a List to the virtual assistant's user using Lambda.

Code for Lambda function:
  1. exports.handler =  (event, context, callback) => {
  2.     var bboxResponse = {};
  3.     bboxResponse = {
  4.           "bbox_list": {
  5.             "items": [
  6.               {
  7.                 "title": "United State",
  8.                 "imageUri": "https://cdn1.eminza.com/images/product/600/034/6/034636/alfombra-velours-redonda-bandera-americana.jpg",
  9.                 "textToSend": "United State",
  10.                 "description": "Amazing Country"
  11.               },
  12.               {
  13.                 "title": "Italy",
  14.                 "imageUri": "https://previews.123rf.com/images/itana/itana1710/itana171000147/88367248-bandera-de-italia-en-forma-de-un-bot%C3%B3n-redondo-con-un-ligero-resplandor-y-una-sombra-el-s%C3%ADmbolo-del-d%C3%ADa-de-.jpg",
  15.                 "textToSend": "Italy",
  16.                 "description": "The best pasta"
  17.               },
  18.               {
  19.                 "title": "Spain",
  20.                 "imageUri": "https://previews.123rf.com/images/dvarg/dvarg1406/dvarg140601070/29186329-flag-of-spain-as-round-glossy-icon-button-with-spanish-flag.jpg",
  21.                 "textToSend": "Spain",
  22.                 "description": "Nice people"
  23.               }
  24.             ],
  25.             "title": "Countries"
  26.           }};
  27.     
  28.     callback(null, {
  29.         "dialogAction": {
  30.             "type": "Close",
  31.             "fulfillmentState": "Fulfilled",
  32.             "message":{
  33.                 "contentType": "CustomPayload",
  34.                 "content": JSON.stringify(bboxResponse)
  35.             }
  36.         }
  37.     });
  38. };


Blahbox interprets the Lambda response and shows it to the user as is shown below:
‚Äč

    • Related Articles

    • Integrate Amazon Lex

      This article will help you set up Amazon Lex in Blahbox. To access the Amazon Lex trained bot, you must first of all obtain certain information from the AWS platform Data required: User Credentials Bot name, Alias and Version Region Link ...
    • Amazon Lex - List

      With Blahbox, it's possible to send a list to the virtual assistant's user using Amazon Lex To make Blahbox display list , the JSON code below must be pasted in the "Custom Markup" of the appropriate "Response", in Amazon Lex Console: {     ...
    • Amazon Lex - Card - Lambda

      With Blahbox, it's possible to send a Card to the virtual assistant's user using Lambda. Code for Lambda function: exports.handler =  (event, context, callback) => {     callback(null, {         "dialogAction": {             "type": "Close",         ...
    • Amazon Lex - Carousel - Lambda

      With Blahbox, it's possible to send a Carousel to the virtual assistant's user using Lambda. Code for Lambda function: exports.handler =  (event, context, callback) => {     callback(null, {         "dialogAction": {             "type": "Close",     ...
    • Amazon Lex - Suggestion Chips - Lambda

      With Blahbox, it's possible to send Suggestion Chips to the virtual assistant's user using Lambda. Code for Lambda function: exports.handler =  (event, context, callback) => {     var bboxResponse = {};     bboxResponse =  {   "bbox_suggestions": {   ...