Send Slack Notifications via AWS lambda


In this article, we'll go over how to use Incoming Webhooks to send a slack message from AWS Lambda.

The entire PoC (proof-of-concept) uses IaC written with Serverless Framework. You can access this article's FREE template for download HERE

What is an Incoming Webhook?

Incoming Webhooks are a simple way to post messages from external sources into Slack. They make use of normal HTTP requests with a JSON payload, which includes the message and some options. [1]

Above is an architecture diagram showing an API gateway calling lambda function and lambda function sending notification to slack.

Adding the Incoming WebHooks Plugin into Slack.

Go to the Slack App Directory and search: Incoming Webhooks.

Click on Incoming WebHooks and it will display like this:

Next, click on: "Add to Slack"

After adding, you'll be redirected to the settings page for your new app (if you are using an existing app, just load its settings via your app's management dashboard).

From here select the Incoming Webhooks feature, and click the Activate Incoming Webhooks toggle to switch it on. [2]

After the above step, it will generate a curl command and an option to add the newly created Webhook to a slack workspace.

Next, click on the button "Add New Webhook to Workspace "and pick a channel that the app will post to, and then click to Allow your app.

Next, you will be sent back to your app settings, and you should now see a new entry under the Webhook URLs for Your Workspace section, with a Webhook URL that'll look something like this [3]:

Clone Template and Deployment

Now, get the SLS template from here.

Then, update the Webhook URL and Channel Name in the lambda environment variables like this:

Next, run this in your terminal:

npm install && sls deploy

Once the deployment process is completed, we will receive the API endpoint.

Now, using Postman (or any other tool) call your API endpoint; you should see a notification in your Slack channel that looks like this:


By utilizing Incoming Webhooks, we have seen how to send notifications to our slack channel via the lambda function. Since Slack is one of the most extensively used communication tools,  we can now send alerts to Slack channels, which helps teams to communicate more effectively.

If you haven't already, visit this page and download this article's template for free HERE





More from Serverless Guru

Request a quote

Mail us to or call +1 302-656-4409
Serverless Guru, LLC
4023 Kennett Pike #50487
Wilmington, DE 19807
By submitting our form, you are agreeing to receive emails from us which you can opt out of at anytime.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.