Looking for Senior AWS Serverless Architects & Engineers?Let's Talk
In this article, we'll go over how to use Incoming Webhooks to send a slack message from AWS Lambda.
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. 
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. 
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 :
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:
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