title: How to get incoming sendgrid email on firebase functions
body: <p>I have a firebase function which I use as a webhook for sendgrid's inbound parse webhook. So that means whenever an email is sent to my domain, it calls the webhook. I know the webhook is being called, but I can't get to the data being sent by Sendgrid. <a href="https://sendgrid.com/docs/for-developers/parsing-email/setting-up-the-inbound-parse-webhook/#example-raw-payload" rel="nofollow noreferrer">This link</a> states that all the information (text, sender, ect) should be right there in the headers. However when I print out <code>req.headers</code> I get this:</p>
  
  <pre><code>{ host: 'us-central1-project-name.cloudfunctions.net',
    'user-agent': 'Sendlib/1.0 server.sendgrid.net',
    'transfer-encoding': 'chunked',
    'content-type': 'multipart/form-data; boundary=xYzZY',
    forwarded: 'for="ip";proto=https',
    'function-execution-id': 'id',
    'x-appengine-city': '?',
    'x-appengine-citylatlong': '0.000000,0.000000',
    'x-appengine-country': 'US',
    'x-appengine-default-version-hostname': ~~~~~~~~~~~~~.appspot.com',
    'x-appengine-https': 'on',
    'x-appengine-region': '?',
    'x-appengine-request-log-id': 'super-long-id',
    'x-appengine-user-ip': 'ip',
    'x-cloud-trace-context': 'id/number;o=1',
    'x-forwarded-for': 'ip',
    'x-forwarded-proto': 'https',
    'accept-encoding': 'gzip',
    connection: 'close' }'
  </code></pre>
  
  <p>(Obviously I replaced all the ID's and everything)</p>
  
  <p>Where is the email information? I have tried doing all of the following and none of them produced any information regarding the email. </p>
  
  <pre><code>exports.reciever = functions.https.onRequest((req, res) =&gt; {
    try {
     console.log("Email recieved");
     console.log(req);
     console.log(req.headers);
     console.log(req.header.to);
     console.log(req.body);
     console.log(req.get('to'));
     console.log(req.body.to);
     console.log(req.rawBody);
     console.log(req.query);
     console.log(req.query.to);
     console.log(req.params);
     console.log(req.path);
     console.log(req.rawBody);
    } catch (e) {}
    finally {
        res.send("2xx");
    } 
  })
  </code></pre>