A simple AWS lambda function that takes a Azure Devops webhook payload, creates a Discord-compatible webhook payload, and executes the appropriate Discord webhook. This repository is coded in dotnet.
Setup instruction:
- Create an AWS Lambda function. Choose .Net 6(C#/PowerShell) as the runtime and upload the published code.
- Define the environment variable in lambda:-
- discord_id - Discord webhook id
- discord_token - Discord webhook token
- Change the handler to AzureDevOpsDiscord::AzureDevOpsDiscord.Program::Handler
- Create an HTTP API in AWS API Gateway
- Add integration with the lambda function. Choose Version 2.0
- Define your preferred route.
- Create a webhook in Discord, take note the URL will contain the discord id and token.
- Create Azure Devops webhook from Project Settings -> Service Hooks.
- Add Web Hooks. Currently only these events is supported: Build Completed, Pull Request Created, Updated and Commented On
- Fill in the URL with this format: (https://[Api_Url]/[Route])
- Test and save the webhook.
The diagram below shows how the flow work.
https://discordapp.com/developers/docs/resources/webhook#execute-webhook