2
votes

I'm part of a team that is trying to integrate AWS Lex into one of our web applications. Currently, the approach that we are going for is one where the user asks Lex to run a SQL query. Lex will then decide the appropriate intent based on the user's question (I.E if user wants to search using value A, Lex will choose intent A) and send this information back to our web application which will then run the appropriate method for executing the SQL query (where method name matches the intent name).

To recap, what we want to do is as follows:
1) User tells Lex that they want to search for data using Value A
2) Lex determines the correct intent (Intent A)
3) Lex sends this information to Lambda which then returns the intent name to the web client
4) Our web application intercepts this response from Lambda and executes the correct method
5) Results shown to the user via Lex.

My question is whether or not this is possible, particularly the intercepting of the Lambda response. If so, can anyone please point me to the relevant information as to where I can read up on how to implement this? I've been searching for the last couple of days and have not found any relevant materials for this particular use case.

Thanks a lot!

1
Have you implemented any of this, yet? You can't exactly "intercept the Lambda response" -- but you should be able to write the Lambda function so that it makes an HTTP request to your web server and the Lambda function then returns the appropriate extract from that data to Lex in the correct format.Michael - sqlbot
Hi Michael, I've actually got a working lambda function and a working lex bot. Its the integrating part that I haven't really done yet.Arun Balasubramaniam

1 Answers

1
votes
  1. User tells Lex that they want to search for data using Value A
  2. Lex determines the correct intent (Intent A)

I think you should be using single intent and different slots for this, it will be more efficient.

  1. Lex sends this information to Lambda which then returns the intent name to the web client
  2. Our web application intercepts this response from Lambda and executes he correct method

You should write a Rest API at your web server which will get the data and return output. In your Lambda function you can write simple HTTP request/post method do request the api and get the response.

  1. Results shown to the user via Lex

After you get the response you can simply return the response to the bot using Close.

Hope it helps.