September 2018
Intermediate to advanced
266 pages
7h 26m
English
To test that this Lambda works properly, we can run some tests on it. The only values that need to be passed into this Lambda are the body and httpMethod. Because the body is a string, we need to escape the quotation marks:
{ "body": "{\"text\":\"I want to buy a shirt\", \"sessionID\": \"abc123\"}", "httpMethod": "POST"}
Running this test should result in this response, which is in the format that API Gateway expects:
{ "statusCode": "200", "body": "{\"message\":\"What size of shirt are you looking for?\"}", "headers": { "Content-Type": "application/json", "Access-Control-Allow-Methods": "*", "Access-Control-Allow-Origin": "*" }}
Read now
Unlock full access