how to get a questions from lex bot in lambda functions

203
February 21, 2018, at 3:01 PM

I tried for retrieving the questions which are asked by the lex bot into the lambda functions and to store in dynamoDB I want the syntax to get the questions from amazon lex. I tried this

"const question1=intentRequest.currentIntent.prompts.FlowerType"

but it gives me an error so guys try to help me

Answer 1

If you look at the JSON getting from Lex to Lambda looks like below,

{ 
  "messageVersion": "1.0", 
  "invocationSource": "FulfillmentCodeHook", 
  "userId": "876669698689967676", 
  "sessionAttributes": {}, 
  "requestAttributes": null, 
  "bot": { 
    "name": "LexBotName", 
    "alias": "$LATEST", 
    "version": "$LATEST" 
  }, 
  "outputDialogMode": "Text", 
  "currentIntent": { 
    "name": "WorkingHours", 
    "slots": {}, 
    "slotDetails": {}, 
    "confirmationStatus": "None" 
  }, 
  "inputTranscript": "The question you have asked" 
}

The key "inputTranscript" is where you will get the question. so you get the question by,

var question = event.inputTranscript

where 'event' is the first parameter of Lambda handler function.

READ ALSO
node_modules commit issues in Azure with local git over and over

node_modules commit issues in Azure with local git over and over

First and foremost, I am trying to have my azure app service host my create-react-app as well as use it to store my code, minus the node_modulesThat said, I have started from scratch a few times after searching, asking here and elsewhere, but each time, when I go to push, somehow...

179
Video and audio mixer with audio recording capability using nodejs

Video and audio mixer with audio recording capability using nodejs

How can I make a video and audio mixer with audio recording capability using nodejsAlso I want an editable waveform graph of audio

211
Unable to install “testmybot” npm package

Unable to install “testmybot” npm package

I am trying to use this sample to demonstrate the chatbot testing using node "testmybot" packageWhen I execute "npm install" command I am getting error

163
React/Redux Dispatching actions on server side

React/Redux Dispatching actions on server side

I am trying to dispatch an action from server side in a React/Redux applicationSame method works fine when invoked from client side but always goes to catch block when called from server side

195