Recently in one of our support tickets, a customer enquired on whether Microsoft Teams as a notification channel would be implemented in upcoming releases, as he heard of it in the INTEGRATE 2017 event
, where Saravana introduced ServiceBus360
and Teams was one of the notification channels there.
Therefore, I thought if I could provide an alternate workaround to achieve the same in BizTalk360
. This often occurs in Support where if we don’t have the functionality currently in the product, we do strive to provide a similar working functionality by discussing it with the development team. Here is my implementation of the feature request by using Logic Apps & WebHook Notification Channel.
Create the Channel in Microsoft Teams
Once the Team has been given a suitable name and was successfully created, then we can create a new channel for that Team. (Click the … near the newly created Team and choose ‘Add channel’.
Once the Channel has been created we can use the Team name & Channel Name in the Azure portal as the destination for the Post Message (Teams).
This can be achieved via Logic Apps or by creating a custom Notification channel. We will have a quick look at both the implementations.
1. Implementation via Logic Apps
Configuration in Logic Apps:
So I created a Demo Logic App, and here is a screenshot of the design used.
I’ve used a Request-Response and added an Azure function to help Parse the JSON response received from the BizTalk360 Notification channel
and then passed that composed message to a Post message action for Microsoft Teams. Azure will ask you to authenticate your login (Teams) and then allow you to select the specific Team and Channel from Microsoft Teams.
In the 1st
Request, you will also need to supply the Request Body JSON Schema or use sample Payload to generate the schema. Please refer to this code
for the Schema I used.
Azure Function Code implementation
To access the code used for the Azure function, please access this code
at Github website.
Configuring BizTalk360 WebHook Notification Channel for the Logic App
Please refer to this article which describes how to set up Webhook notification Channel.
You can get the URL for the Web API from the Logic App – refer to the screenshot earlier provided and the arrows identify where to get the URL from. Use that in configuring the BT360 webhook notification channel.
Once the WebHook Notification Channel is configured, you can select it as the notification option in the specific Alarm
Receiving the Notifications
Once the Threshold is violated, similar to the Email notifications, you will now see a notification in Microsoft Teams.
While I have parsed the JSON message and only displayed the Application Name & Artifact Name that has the error, you can choose and customize your error messages as required.
2. Implementation via Custom Notification Channel
You can read these articles which show how to create a custom notification channel.
You need to select the WebHook Connector from Microsoft teams. You need to copy the WebHook URL which you will then enter the code in the custom notification channel.
You then need to setup the Custom Notification Channel as mentioned in the blogs.
Then you only need to add this code
to the FileChannel.cs file either instead of after the successful completion of File notification completed. Again I have only output Alarm Name and an Error string. Please customize as required.
So I hope this blog gave you a good idea as to how you can integrate Teams with BizTalk360 Notifications.