-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlambda_function.py
More file actions
17 lines (14 loc) · 856 Bytes
/
lambda_function.py
File metadata and controls
17 lines (14 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""
Function to return TwilML content back to the client
"""
def lambda_handler(event, context):
# for debugging, first print event contents
print 'input to lambda {}'.format(event)
# twilio expects an XML content for generating the voice. This is written in something strange called TwiML
# Ignore all the blah blah in the angular brackets and the actual voice message is "Hi! ....".
# The voice is spoken by Alice - <Say voice = "alice">
# The actual voice content is within the <Response> tags
xml_content = """<?xml version="1.0" encoding="utf-8"?><Response><Say voice = "alice">Hi! Hope you are having a great time hacking code in the meetup</Say></Response>"""
# frustratingly, lambda can not send XML content so we are wrapping it in the dummy JSON variable
dummy = {'body' : xml_content}
return dummy