Is it possible to get response from lex into HTML page using Javascript(outside chatbot)?
Say I need details about the some customer, when I enter "Give me details about customer_01" in lex, it must respond back with customer_01 details like name, DOB etc in pop-up window in browser but not inside bot. I've also using AWS lambda and been looking in many blogs and websites, didn't find any solution to this.
If this is possible,It would be really great if you could explain the details. I'm building app in python, any solution with other languages is also appreciated.
Thank you in advance.
My code is still in beginner stage, here it is:
#checking if customer_id is in input, if present extracting it and storing in "req_customer"
query="Select * from customer where customer_id="+"'"+req_customer+"'"
df= pd.read_sql(query, conn) #storing result in from SQL in dataframe.
name=df['name'][0]
address=df['address'][0]
dob=df['dob'][0]
phno=df['phno'][0]
htm='''<h2>Customer Name: '+name+'</h2> #these are the things I want to
<p>Phone Number: '+phno+'</p> #display in pop-up window in the
<p>Date of Birth: '+dob+'</p> #same page
<p>Address: '+address+'</p> '''
response = {
"dialogAction": {
"type": "Close",
"fulfillmentState": "Fulfilled",
"message": {
"contentType": "CustomPayload",
"content": htm
}
}
}
return response