In our last blog post, we shared how to send simple ArcGIS Monitor notifications to Microsoft Teams. Since then, we have been tinkering more with ArcGIS Monitor in an attempt to get more detailed information from our clients’ servers. In the process, we’ve found the need to set up additional notifications using Teams webhooks.
There are several reasons you might want to set up something similar: Proof of Concept starting blocks or maybe, like us, you want custom notification content. Let’s examine each of those reasons:
The first step of this process is to add the WebHook Connector to your Teams channel. Microsoft has a great help document on the webhook connector and how to add it to your Teams channel.
The next step is to configure your python script to write to the webhook. A variable that contains the webhook URL from the previous step will need to be put into the code. In our code example you can see where to include this. The business logic will depend on what you’d like to show in your team’s chat. For us, we just wanted to show the overall categories and the descriptions associated with them. You could parse the values to change colors or labels depending on the alerting status. You could also include images and even links. All of this will depend on what you and your team decide is important.
This script will need to be run so that it can check into ArcGIS Monitor and post into Teams. We chose Windows Task Scheduler for this. We set it up to run once an hour, but you might want to adjust it to the start of the day, midday, or any time interval that works for you.
Open Windows Task Scheduler and create a new Task. Name the task and give it a description. You will need to define the Trigger and timing. We chose daily, once an hour, indefinitely. Once you have created the task you can fine tune the trigger times from inside the task.
We have placed the python script into our GitHub repository so you can have a good starting place.
Have questions? Did you get your ArcGIS Monitor notifications set up? We’d love to hear from you! Email us or post a comment below.