title: Unable to read payload from POST req to API G/W endpoint triggering Lambda
body: <p>have a 3rd party application in which I have subscribed my AWS API Gateway endpoint URL so that whenever an event occurs in my 3rd party application, that should trigger my API gateway endpoint which eventually is a trigger for my Lambda function.</p>
  <p>In my lambda function I want to read event payload and send that to some other application.</p>
  <p>Currently, I am unable to read event data in my lambda function.</p>
  <p>POST Request from Postman:
  <a href="https://16f89u5f9b.execute-api.us-east-2.amazonaws.com/default/test123?name=postmanName&amp;city=postmanCity&amp;time=postmanTime&amp;day=postmanDay" rel="nofollow noreferrer">https://16f89u5f9b.execute-api.us-east-2.amazonaws.com/default/test123?name=postmanName&amp;city=postmanCity&amp;time=postmanTime&amp;day=postmanDay</a></p>
  <p>API Gateway endpoint :
  <a href="https://16f89u5f9b.execute-api.us-east-2.amazonaws.com/default/test123" rel="nofollow noreferrer">https://16f89u5f9b.execute-api.us-east-2.amazonaws.com/default/test123</a></p>
  <p>This API gateway is a trigger for my lambda function.</p>
  <p>Response in Postman:
  {
  &quot;message&quot;: &quot;Good LambdaTime, postmanName of postmanCity. Happy LambdaDay!&quot;,
  &quot;input&quot;: {
  &quot;resource&quot;: &quot;/test123&quot;,
  &quot;path&quot;: &quot;/test123&quot;,
  &quot;httpMethod&quot;: &quot;POST&quot;,
  &quot;headers&quot;: {
  }</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>'use strict';
  console.log('Loading hello world function');
   
  exports.handler = async (event) =&gt; {
      let name = "LambdaName";
      let city = 'LambdaCity';
      let time = 'LambdaTime';
      let day = 'LambdaDay';
      let responseCode = 200;
      console.log("request: " + JSON.stringify(event));
      
      if (event.queryStringParameters &amp;&amp; event.queryStringParameters.name) {
          console.log("Received name: " + event.queryStringParameters.name);
          name = event.queryStringParameters.name;
      }
      
      if (event.queryStringParameters &amp;&amp; event.queryStringParameters.city) {
          console.log("Received city: " + event.queryStringParameters.city);
          city = event.queryStringParameters.city;
      }
      
      if (event.headers &amp;&amp; event.headers['day']) {
          console.log("Received day: " + event.headers.day);
          day = event.headers.day;
  
      }
      
      if (event.body) {
          let body = JSON.parse(event.body)
          if (body.time) 
              time = body.time;
      }
   
      let greeting = `Good ${time}, ${name} of ${city}.`;
      if (day) greeting += ` Happy ${day}!`;
  
      let responseBody = {
          message: greeting,
          input: event
      };
      
      // The output from a Lambda proxy integration must be 
      // in the following JSON object. The 'headers' property 
      // is for custom response headers in addition to standard 
      // ones. The 'body' property  must be a JSON string. For 
      // base64-encoded payload, you must also set the 'isBase64Encoded'
      // property to 'true'.
      let response = {
          statusCode: responseCode,
          headers: {
              "x-custom-header" : "my custom header value"
          },
          body: JSON.stringify(responseBody)
      };
      console.log("response: " + JSON.stringify(response))
      return response;
  };</code></pre>
  </div>
  </div>
  </p>