Notify Slack about GitHub Releases using AWS Lambda

February 24th, 2018 501 Words

Do you use GitHub to manage your software projects and Slack for communication? With GitHub Webhooks and a simple AWS Lambda function, you can notify Slack channels about new releases of your projects.

Serverless Application Model

To start, just clone the project from GitHub and create a file to store basic AWS configuration for your webhook handler.

$ > git clone
$ > cd github-releases-slack

$ > touch .env

Open the .env file with your favorite editor and set your AWS environment.


After installing the need Go dependencies, you can build and deploy your AWS Lambda function:

$ > make dependencies
$ > make deploy

When the deploy process finished, you can access the public URL of the Amazon API Gateway for your Lambda function.

$ > make outputs

    "OutputKey": "URL",
    "OutputValue": "",
    "Description": "URL for HTTPS Endpoint"

Based on the Path and Method configuration set in infrastructure.yml, your AWS Lambda function can be triggered when sending a request to the following URL:{token}/{channel}

With the values for {token} and {channel} being configured within the URL, you can easily use the same AWS Lambda for multiple projects, channels, and Slack environments when needed.

Create Slack Bot

First, install the bot integration for your Slack Workspace. Select Administration > Manage Apps from within Slack, click on Browse in the top navigation, and search for Bots:

Add Slack Bots to your Workspace

After you select Bots, you can add a configuration and obtain the needed API token for your integration.

Configure Slack Bot API Token

Copy the value for your API Token ; you will need this in the next step to configure the GitHub Webhook.

GitHub Webhook

Open the settings for your GitHub project, select Webhooks from the navigation, and click on the Add Webhook button.

Configure GitHub Webhook

To configure the Payload URL you need the URL of your AWS Lambda function, the Slack Token, and you must decide on the channel where your notification should be posted.

The URL for the GitHub Webhook has the following schema:{token}/{channel}

With the Slack Token and releases as the channel, the final URL would be:

Select Let me select individual events, deactivate the checkbox for Push and enable Release for the event you want to receive. Make sure the checkbox for Active is enabled and you have set the content type to application/json for the request.

Configuration & Testing

With the enabled GitHub Webhook, it’s time to finally test the integration! First, you need to make sure your Slack bot has joined your configured Slack channel.

Open Slack and join the channel where your notifications should be posted. With the command /invite @YourSlackbotName you can invite your bot to the channel and it will join immediately.

After the bot joined your channel, head over to GitHub and create a new release.

Configure GitHub Webhook

When you switch over to Slack again, you should see a message about the new release by your bot! Awesome, right? Do you have any feedback on this setup? Just send me a reply on twitter!

View on GitHub Source code is published using the MIT License.