2 min read
Kevin Sadrak

Webhook Powered ArcGIS Monitor Notifications in MS Teams

2 min read
Kevin Sadrak

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. 

Screen Shot 2023-02-07 at 11.01.12 AM

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:

  1. As a proof of concept and starting point, this hits all the marks.  We can show successful integration between two powerful tools.  Once all these tools are connected together, ideas will start.  We have already started down the path of Teams interaction, working with Power Automate in our previous blog post. The next step is integration with automation workflows such as Power Automate, Automate.io, and pushing into systems like ServiceNow or Microsoft Teams Tasks, or even GitHub.   We can create support tickets and automatically assign them to the right people to review and resolve Enterprise GIS issues.
  2. The notifications from ArcGIS Monitor 10.8 allow us to configure alerts from a collection.  Direct emails can be sent from individual counters such as System, ArcGIS, Portal, and DB.  We can finetune the notifications to better fit the team dynamic.  We can combine counters or collections and we can add extra links, information, or images to help the users understand the issue and help them resolve the issue faster.

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.

Screen Shot 2023-02-07 at 11.02.37 AM
Once you have the webhook configured you’ll need to send json with your ArcGIS Monitor notifications.  We chose to use python to send the JSON to Teams.  To make the process easier we used the pymsteams python module. If you don’t have this module, install it by running pip install pymsteams in Command Prompt or Windows PowerShell.

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.

Screen Shot 2023-02-07 at 11.03.25 AM

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.


Share

Related articles

ArcGIS Monitor Notifications in Microsoft Teams

ArcGIS Monitor Notifications in Microsoft Teams

At dymaptic we monitor many servers and services for our customers. We do this with ArcGIS Monitor, and one of the things ArcGIS Monitor doe...
ArcGIS Monitor 2023.3 Webhook Messages to your Favorite Chat Software

ArcGIS Monitor 2023.3 Webhook Messages to your Favorite Chat Software

A recent blog post I created walked users through setting up ArcGIS Monitor webhooks into Microsoft Teams using Power Automate. For this pro...
ArcGIS Monitor 2023.3 Webhook Messages in MS Teams

ArcGIS Monitor 2023.3 Webhook Messages in MS Teams

The newest version of ArcGIS Monitor is available, and it packs a lot of great improvements. One of the new features is webhooks from Collec...