In this post, I will try to show the easiest way to integrate these two systems and share my code and findings in one place. So, don’t expect anything fancy because this is still a work in progress and it will grow in functionality. As an easy example, I decided to use the GitHub trigger on the creation of a new issue in the Repo. That being said, the first thing I had to do is to create a function which I need to expose and use the Azure function URL to create a webhook in the desired GitHub repository. I used C# for the development of the integration.
If you are just starting with Azure Functions with Java and you came upon this blog post, this is what I have followed and installed and eventually used and tested successfully. Take a look: The quickstart of how to use Java and Maven to create and publish a function to Azure.
If you want to use C#, then you need the latest version of Visual Studio 2019 from which you have all the support needed to develop and deploy in Azure Functions and much more.
Ok let's start with the code of the Azure function written in C# then a setup of the GitHub webhook and setup of the Workplace Bot
It’s fairly simple to create a GitHub webhook, choose your desired repository and create a trigger on which actions you want the Azure function to be called. In my case, I created a GitHub webhook when a new issue is created. This is how it looks in my repo:
I haven’t created a secret key in the Azure functions yet, but that is one of my next steps. This was a quick PoC where I wanted to test the possibility of the integration between Github and Workplace by Facebook.
I will not go into too much detail here only to explain which info we need from the Workplace bot so we could post the content on the desired Workplace group. This is also related if you are using Facebook groups, fun pages or just your Facebook wall.
Take a look at: Read more about the Facebook bots
As a simple test here let’s create an issue in our repo:
As soon as we post the issue we can check the workplace group wall for the new GitHub issue post.