Webhooks (MS Teams)


Setup a Microsoft Teams connection for Streaming Data Platform alerts using Webhooks.

Set up 

0. To create a webhook in your MS Teams workspace you can use this guide

At the end of the process you get a url of the format:
https://YOUR_URL.webhook.office.com/webhook2/<secret-token-by-ms>/IncomingWebhook/<secret-token-by-ms>

You’ll need the second part

/webhook2/<secret-token-by-ms>/IncomingWebhook/<secret-token-by-ms>

for the Request Path later in this guide.

1. Visit Admin → Connections and click New connection

Lenses.io Connection

2. Select Webhook

Webhook Connection

3. Provide a name and configuration

You can also optionally add tags (i.e. teams). Then add the Webhook configuration information with host outlook.office.com as included in the Microsoft Teams webhook URL. Moreover make sure that the Use HTTPS switch is turned on.

Webhook Connection Configuration

Add channel 

Next add one or multiple target Webhook channels.

1. Visit Admin → Channels and click Webhook

Webhook channel for Microsoft Teams

2. Setup the configuration options

For example the above will create the MS Teams Webhook, that is using the Webhook connection of microsoft-teams to POST in the general channel.

In the field Request path you need to fill in the part of the Webhook URL like this /webhook2/<secret-token-by-ms>/IncomingWebhook/<secret-token-by-ms>.

In the field Body payload you need to use a custom payload based on the requirements of Microsoft Teams for messages. The following snippet shows an example payload for a simple message:

{"text": "{{CATEGORY}} {{LEVEL}} {{ID}}"}

Below is the configuration for Microsoft Teams alert channel:

Webhook channel for Microsoft Teams details

Test the configuration 

To test the configuration follow this guide for Consumer Alerts and set lag >= 0 this will immediately trigger an alert.

An example 

If for example you create a rule to send infrastructure notifications to Microsoft Teams via Webhook, then the moment a Broker becomes offline, an HTTP POST will be made to the Microsoft Teams Webhook endpoint.

--
Last modified: November 18, 2024