RandomDude
RandomDude

Reputation: 1141

Access request headers in doPost()

To verify a webhook i need to get a parameter from the request headers. So far i couldn't find any information if it is actually possible to access these headers within Apps Scripts. Only thing that works so far is accessing the body of the post request.

function doPost(e) {
    // something like this
    var headerParam = e.headers['Content-Type'];
    // ...
}

Upvotes: 4

Views: 4316

Answers (1)

TheAddonDepot
TheAddonDepot

Reputation: 8964

Unfortunately this is not currently possible with doPost() triggers. However there is a pending feature request for this issue on Google's issue tracker. If you'd like to see this feature supported please leave a comment (on the issue thread linked below) and be sure to STAR the issue at the following link:

https://issuetracker.google.com/issues/67764685

The workaround I currently use is to leverage Google Cloud Functions. I wrote a related article about it here.

Upvotes: 10

Related Questions