Is it possible to send alerts to Microsoft Teams channel?

Is it possible to send alert notifications to a Microsoft Teams channel?

Q: I need to post a message to a Microsoft Teams channel every time alert is executed. How can I do that?

A: Please follow the tutorial below, explaining how to post IPHost Network Monitor alert notifications to Microsoft Teams channel using the Incoming Webhook connector. Alerts will appear in a channel in form of cards.

1. Create a connector

In a new or existing channel that will be used for alerts, open “Connectors”:

Microsoft Teams notifications - create channel

Create a new Incoming Webhook connector, give it a name (e.g. “IPHost Monitor”), upload an icon if you wish (feel free to use the below one):

IPhost Network Monitor icon 96x96

Resulting connector page:

Microsoft Teams notifications - connector settings

Copy and save the Webhook URL.

2. Create Send HTTP(S) request action

Now open IPHost GUI client and create new “Send HTTP(S) request” action (click “Alerting > Alerts”, select “Simple Actions” tab):

Microsoft Teams notifications - create HTTP(S) request action

In this action, paste URL copied on previous step, and define JSON payload using the template variables:

Microsoft Teams notifications - new HTTP(S) action

Fill the fields like below:

  • URL: Webhook URL obtained at step 1
  • Request Method: choose POST
  • POST Data (message payload): insert the below text
      "@context": "",
      "@type": "MessageCard",
      "summary": "$EventDetails",
      "sections": [
          "activityTitle": "**$EventDetails**",
          "activitySubtitle": "[$MonitorName]($MonitorReportUrl) on [$HostName]($HostReportUrl)",
          "activityImage": "//$NewState.png",
          "activityText": "Monitor state: $EventShortDescription $Duration | since $Time"

Leave the rest of fields unchanged.

Now you can add newly created Simple Action to an existing alert, for example to “E-mail to Administrator + Popup” alert used by the Default Alerting Rule. Click “Alerts”, select “E-mail to Administrator + Popup” (or any other alert of your choice), and click “Edit”. Use “Add” drop-down in a newly opened alert editor to add “Post to MS Teams #Alerts channel” newly created simple action:

Microsoft Teams notifications - add HTTP(S) action to alert

You could also create a new alert for this action, and use it in existing named alerting rules, or use it inline in alerting configuration of particular monitors or groups.

3. Test Microsoft Teams notifications

Now that “Post to MS Teams #Alerts channel” action has been added to alerts, try putting a monitor to Down state and back (by altering its “State conditions” and polling the monitor), or use “Alerting > Testing” tab to simulate alert execution.

If integration has been done correctly, you will see something like below in your Microsoft Teams channel. Note that alerts are identified by IPHost state icons:

Microsoft Teams notifications - see in action

Related topics