> 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**.

   <figure><img src="https://lh3.googleusercontent.com/3WjrkRdG1_TnfQ5w-9Ivg6J0xjic4znbfN3_76HX6quIGo5sydsEub8aMXrv9_MQsfAorYc4gUOwgIGK9JOpu0ysmI_dXFFtwlRk6LarMYu5xEgOHsJ2_9qHgKdw4Kf3MTFKX2v2EkBD5e80zC9tEZXUnFJnCfPLbaGCGv2h4omcpK10ntHdYvaVBA" alt=""><figcaption><p>AWS Lambda function box</p></figcaption></figure>
5. In the **Resources**, lick the new **POST** method.
6. Click **Integration Request** (top right on the AWS Gateway POST method execution screen).

   <figure><img src="https://lh5.googleusercontent.com/_Prq2fJ7F-NE4jEiw1tqYIn0Bq-HTG0_wahTwkrod8zisAkjtKmL3O1Y0c8XEh2iYeibdkh1jWYR3V_jGvdWCbUEfE5LXd7I7cTovohFD81-NFGTvesu1jIFGKjRIWm88dAG_qcgKBQVMO7YrHvVcnERYFvr91I18K36137u2z4suVA_3P_xj8aCpQ" alt=""><figcaption><p>AWS Gateway POST method execution</p></figcaption></figure>
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 the resulting display reflects these entries.

   <figure><img src="https://lh6.googleusercontent.com/d0AynUJWVROWc0ff2EnY_NAT7kqkrvBThXMw8d9D0StX1KKoig7ol2uDqLoMOCt7UBP7C3RYiSUrcZlg9yglP08fVXf8WBxOvGHtV25hw5PsfQC_lWfoDJkl38kIaqBNxIdg_k7W4Qg5jvQ-faPp4ySOF5j15vWRxCEjxzvAIhsHpl3s3dE2lolJdg" alt=""><figcaption><p>AWS API Gateway POST request Mapping Template with code</p></figcaption></figure>


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
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=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
