> For the complete documentation index, see [llms.txt](https://docs.snyk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.snyk.io/developer-tools/snyk-api/using-specific-snyk-apis/webhooks-apis/guides-to-webhooks/how-to-use-snyk-webhooks-to-connect-snyk-to-slack-with-aws-lambda/aws-lambda-setup-set-up-the-trigger/with-api-gateway/aws-api-gateway-add-the-post-method-to-connect-snyk-to-slack.md).

# AWS API Gateway: add the POST method to connect Snyk to Slack

How to add the POST method in AWS API Gateway to connect Snyk to Slack

The payload Slack will receive will have a message, so create a POST method that will receive the message, verify it is a valid message, and then send on to the AWS Lambda function.

Follow these steps to add the POST Method:

1. Navigate to the AWS API Gateway you have created.
2. Click **Resources**.
3. To create the method, navigate to **Actions** -> **Create Method** -> **Post**.
4. Configure the AWS API Gateway to work with the Lambda function you created by adding the Gateway in the adjacent Lambda function box:\
   Choose the **Lambda Function Integration type**.\
   Select **Default Timeout**.
5. In the **Resources**, click the new **POST** method.
6. Click **Integration Request** (top right on the AWS Gateway POST method execution screen).
7. Scroll to the bottom and add a **Mapping Template** with **application/json Content-Type**. To the template add the following code:\
   `{`\
   `"method": "$context.httpMethod",`\
   `"body" : $input.json('$'),`\
   `"headers": {`\
   `#foreach($param in $input.params().header.keySet())`\
   `"$param": "$util.escapeJavaScript($input.params().header.get($param))"`\
   `#if($foreach.hasNext),#end #end`\
   `}`\
   `}`
8. Verify that the **Mapping Template** shows the code you added.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.snyk.io/developer-tools/snyk-api/using-specific-snyk-apis/webhooks-apis/guides-to-webhooks/how-to-use-snyk-webhooks-to-connect-snyk-to-slack-with-aws-lambda/aws-lambda-setup-set-up-the-trigger/with-api-gateway/aws-api-gateway-add-the-post-method-to-connect-snyk-to-slack.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
