Building AWS Serverless Blogs Notifier for MS Teams to stay up to date with Serverless best practices

Dmitry Lozitskiy
3 min readMar 8, 2021

--

Teams Channel Notification

Following advancements in serverless world is exciting but sometimes can be hard to keep up with.

In this hands-on post I’ll guide you through setting up a serverless app that will keep you and your teammates updated about new serverless blogs and best practices via Microsoft Teams channel notifications.

Architecture Overview

Solution Architecture

As you can see on the architecture diagram, the AWS compute blog RSS feed is parsed by Lambda function and then filtered based on the article tags. We are particularly interested to notify about articles with serverless tag.

Once the function finds an article of interest, the metadata about it gets published via MS Teams webhook to MS Teams Channel as a card and guidof a successfully published article is recorded in a database.

Teams Setup

While this article is focused on setting up an integration with Microsoft Teams, you can easily tweak the function to achieve the same result with Slack webhooks.

Create a standard Teams channel that you want to be notified to. Add incoming webhook for the channel as described here, optionally you can upload an avatar image that will be used by integration. Capture a webhook URL, you will be using it later to configure the integration.

AWS Setup

For github actions to deploy you SAM template, you need to create an S3 bucket in your account. Create the bucket and capture a bucket name, you will be using it later to configure the integration.

Github Setup

The solution is deployed using Github Actions. All you need to do is to fork the repository and configure your own repository secrets.

The workflow definition for the CI/CD process is stored under .github/workflows . You can see that the workflow will be triggered by the commit into the main branch, it will validate the SAM template with function definition, build the deployment package and upload it to S3, and deploy the stack into AWS account.

Following secrets will need to be configured on your github repository to successfully deploy the solution to your account:

Github repository secrets

Update WEBHOOKURL with the URL of your MS Teams integration and S3BUCKET with the name of the bucket you created earlier.

Github Actions will use an IAM user AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to deploy the stack into AWS environment, follow this guide to create a new AWS API key for github actions to use.

It’s a good practice to have a dedicated IAM user for github actions, also ensure that the user has correct level of permissions to deploy the resources, in my case I gave user an admin access for simplicity.

Note: when you start using github actions, it’s worth to ensure that your github account has two-factor authentication enabled.

Solution Running Cost

The cost of the solution will stay within AWS free tier and will cost you $0 to run.

Conclusion

That’s it, after the repository secrets are configured, you can trigger the github workflow manually or via commit to the main branch and see the deployment progress in action.

After successful deployment, your MS Teams channels will be notified with the latest blogs (initial sync) within 1 hour. After that you will be notified about new published blogs regularly within 1 hour of their release date.

Happy serverless learning!

--

--