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
![](https://secure.gravatar.com/avatar/cf0592fc35f43f9130b22828e8eea965?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)