Add optional custom headers to slash command requests
I have recently implemented a small custom slash command for our company, that makes a GET request to an AWS API Gateway resource, baked by an AWS Lambda function. This is a very conventient way to implement simple, for lack of a better, less overused term, microservices in a serverless environment.
One limitation with this approach is that to secure such a API Gateway + Lambda service, AWS relies on API keys, which have to be sent in the form of a custom request header X-API-Key, lest we implement yet another separate Lambda function to serve as the so called authorizer, which allows using a request query parameter instead (e.g. we could make the slash command URL something like https://abcdefgh12345678.execute-api.us-west-1.amazonaws.com/stageName/methodName?apiKey=whateverTheAwsKeyIs).
It would be great if we could specify custom headers to be included in the slash command request, so in this instance, if we could specify something like.
Request Method: GET
Request URL: https://abcdefgh12345678.execute-api.us-west-1.amazonaws.com/stageName/methodName
Request Headers: X-API-Key: whateverTheAwsKeyIs