Posting a message to an MS Teams channel

This documentation references external sources. Nexthink does not have control over the accuracy of third-party documentation, nor any external updates or changes that might create inconsistencies with the information presented on this page. Please report any errors or inconsistencies to Nexthink Support.

This document demonstrates how to post a message to an MS Teams channel using a webhook.

In MS Teams

After creating a new MS Teams channel, configure an incoming webhook:

  1. Use the three dots on the channel and choose Connectors.

  2. From the open pop-up, search Incoming Webhook and click on Configure. See image below

  1. Name the incoming webhook and optionally change the displayed icon.

  2. Create the incoming webhook.

  3. Find at the bottom of the module a new section with the following information.

  4. Copy the URL for future reference. See the following example: https://nexthink.webhook.office.com/webhookb2/5d4e17ca-3fb8-4799-b1a6-9e393959c4b3@13387b29-82d9-4ca5-9fa0-b7b5635742ef/IncomingWebhook/5fcc84f00dfb4ad9bbdcd94a86e53864/69227ead-2e93-461f-91e1-f03494393957

In Nexthink

From the Nexthink web interface:

  • Configure a connector credential for the incoming webhook from MS Team

  • Configure and test a webhook to post messages in the MS channel

Configuring a connector credential for MS Team

From the connector credential configuration page, fill out the fields using the information from the configured incoming webhook in MS Teams:

  1. Choose the HTTPS option from the Protocol drop-down.

  2. Paste https://nexthink.webhook.office.com from MS Teams connection into the URL address field. See step 6 above.

  3. Choose No Auth (None) option from the Authorization drop-down.

  4. Save the credential.

Configuring a webhook for MS channel

From the webhook configuration page, fill out the fields using the information from the connection you created in MS Teams and the connector credential defined in Nexthink:

  1. Fill in the Name and Description.

  2. Fill in the NQL Condition following the Configuring webhook NQL conditions documentation.

  3. Choose the connector credential you configured MS Team from the Credentials drop-down.

  4. Select the POST from the Method drop-down.

  5. Copy and paste into the Resources field, the URL endpoint from the MS Teams connection without the URL address. For example: webhookb2/5d4e17ca-3fb8-4799-b1a6-9e393959c4b3@13387b29-82d9-4ca5-9fa0-b7b5635742ef/IncomingWebhook/5fcc84f00dfb4ad9bbdcd94a86e53864/69227ead-2e93-461f-91e1-f03494393957

  6. Add the message you want to send in Payload. See the example below.

{
 "@type": "MessageCard",
 "@context": "http://schema.org/extensions",
 "themeColor": "0076D7",
 "summary": "Automatic webhook triggered by Nexthink",
 "sections": [
    {
 "activityTitle": "{{alert.monitor.name}} alert {{alert.alerts.status}} by Nexthink with the priority {{alert.monitors.priority}",
 "activitySubtitle": "Application: {{alert.alert.context.application.name}}",
 "activityImage": "https://cdn-assets-cloud.frontify.com/s3/frontify-cloud-files-us/eyJwYXRoIjoiZnJvbnRpZnlcL2FjY291bnRzXC85NFwvMTQwODU2XC9wcm9qZWN0c1wvMTc4MzY0XC9hc3NldHNcLzI2XC8yNTYxMzM1XC8xNGM4NjRmZWNjZDQxODUyOGM3MjhjMDIyMmQyNjA2My0xNTM1MzU5NTQ4LmpwZyJ9:frontify:bu_gT-zWjnzOJ-BvUSZN46o2UWwSKV_CMbv7XZMz7tM?width=626&height={height}",
 "facts": [{
 "name": "Assigned to",
 "value": "Infrastructure Team"
      },{
 "name": "Effective Date",
 "value": "{{alert.alert.trigger_time}}"
      },{
 "name": "Reference Value",
 "value": "{{alert.alert.trigger_reference_value}}"
      },{
 "name": "{{alert.alert.trigger_values[0].alias}}",
 "value": "{{alert.alert.trigger_values[0].value}}"
      },{
 "name": "{{alert.monitor.thresholds[0].alias}}",
 "value": "{{alert.monitor.thresholds[0].value}}"
      }],
 "markdown": true
    }
  ]
}

Notice that the payload example above uses Special placeholders for alerts data model variables.

  1. Send Test to make sure the message is pushed into MS Teams.

Last updated