Send Slack Notifications via AWS lambda

March 18, 2022


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





Serverless Handbook
Access free book

The dream team

At Serverless Guru, we're a collective of proactive solution finders. We prioritize genuineness, forward-thinking vision, and above all, we commit to diligently serving our members each and every day.

See open positions

Looking for skilled architects & developers?

Join businesses around the globe that trust our services. Let's start your serverless journey. Get in touch today!
Ryan Jones - Founder
Ryan Jones
Speak to a Guru
Edu Marcos - CTO
Edu Marcos
Chief Technology Officer
Speak to a Guru
Mason Toberny
Mason Toberny
Head of Enterprise Accounts
Speak to a Guru

Join the Community

Gather, share, and learn about AWS and serverless with enthusiasts worldwide in our open and free community.