Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit bc783e5

Browse files
authored
removed send_message function
No longer needed when resolving the API Gateway format issue returned to Twilio
1 parent 5faf134 commit bc783e5

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

lambda_function.py

+3-13
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
account_sid = "account_sid"
2424
auth_token = "auth_token"
2525
client = TwilioRestClient(account_sid, auth_token)
26-
phone_number = "phone_number" # +10000000000
2726

2827
# create an S3 & Dynamo session
2928
s3 = boto3.resource('s3')
@@ -41,10 +40,6 @@ def sample_filter(im):
4140
filter_image = ImageOps.colorize(ImageOps.grayscale(im), black, white)
4241
return filter_image
4342

44-
def send_message(event, response):
45-
client.messages.create(to=event['fromNumber'], from_=phone_number,
46-
body=response)
47-
4843
def lambda_handler(event, context):
4944

5045
message = event['body']
@@ -58,15 +53,11 @@ def lambda_handler(event, context):
5853
# a new user
5954
if response_dynamo['Count'] == 0:
6055
if len(message) == 0:
61-
response = "Please send us an SMS with your name first!"
62-
send_message(event, response)
63-
return response
56+
return "Please send us an SMS with your name first!"
6457
else:
6558
name = message.split(" ")
6659
table_users.put_item(Item={'fromNumber': from_number, 'name': name[0]})
67-
response = "We've added {0} to the system! Now send us a selfie! ".format(name[0])
68-
send_message(event, response)
69-
return response
60+
return "We've added {0} to the system! Now send us a selfie! ".format(name[0])
7061
else:
7162
name = response_dynamo['Items'][0]['name']
7263

@@ -97,6 +88,5 @@ def lambda_handler(event, context):
9788
else:
9889

9990
twilio_resp = "No image found, try sending a selfie!"
100-
101-
send_message(event, twilio_resp)
91+
10292
return twilio_resp

0 commit comments

Comments
 (0)