-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLF0.py
More file actions
29 lines (26 loc) · 642 Bytes
/
Copy pathLF0.py
File metadata and controls
29 lines (26 loc) · 642 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import json
import boto3
def lambda_handler(event, context):
client = boto3.client('lex-runtime')
print(event)
msg = event['messages'][0]['unstructured']['text']
user_id = 'root'
lex_bot = 'DiningConciergeBot'
bot_alias = 'Greeting'
inputText = msg
res = client.post_text(
botName = lex_bot,
botAlias = bot_alias,
userId = user_id,
inputText = inputText
)
print(res)
response = {
"messages" : [{
"type" : "unstructured",
"unstructured" : {
"text" : res['message']
}
}]
}
return response