Skip to main content

Send notifications to Microsoft Teams

You can enable bidirectional communication between APEX AIOps Incident Management and Microsoft Teams. This integration provides the following features:

  • Incident Management can notify a specific Teams channel when an incident is generated or updated.

  • Incidents in Incident Management contain links to their corresponding team channels in Microsoft Teams.

  • Notifications in Microsoft Team channels contain links to their corresponding Incident Management incidents.

  • Comments from Incident Management can be sent to a specific Microsoft Teams channel.

  • Comments from a specific Microsoft Teams channel can be posted to the relevant Incident Management incident.

  • You can perform the following actions on open Incident Management incidents from within Microsoft Teams:

    • Assign to me

    • Resolve

    • Close

    • Comment

    • Create dedicated IM channel

  • The Microsoft Teams channel is defined using the $assigned_groups substitution in the payload of the incident webhook endpoint.

  • Watchers can also be used in this integration by replicating the instructions for setting up the outbound payload and using $tags.watcher_groups as the substitution.

The messages sent by this integration are displayed as adaptive cards. This allows you to customize the functionality and appearance of messages. For a detailed explanation of how Adaptive Cards work, read Adaptive Cards Overview.

Note

The default time limit for using the buttons on each message card is two hours. If no action has been taken after two hours, the process will stop listening and cancel the flow. You can extend this time limit per instance of the flow, but doing so may result in flow failures.

Before you begin

Before you set up your Microsoft Teams integration:

  • Make sure that you have created a new, interactive integration user within Microsoft Teams with a premium Power Automate license. A premium license is required for these instructions to work.

    For information on Power Automate licensing, read Power Automate Pricing.

    Note

    The display name of the integrations user is what will appear in the messages sent by this integration. To change your display name, read this topic from the Microsoft documentation.

  • Make sure that you have created a new integration user in Incident Management and that you are signed in to Incident Management as this user. Set the first name of the integration user to "Microsoft" and the last name to "Teams."

    See Manage APEX AIOps Incident Management users for instructions on creating a new user.

  • Make sure you have a valid Incident Management API key that you can copy and paste when needed.

    For instructions on creating an API key, read Manage APEX AIOps Incident Management API keys.

Configure Microsoft Teams using Power Automate

  1. Sign in to Microsoft Power Automate using the credentials for the integration user you created.

  2. Upload the flow package:

    1. From the left hand menu, click My flows.

    2. Click Import > Import Package (Legacy).

    3. Click Upload and select the Moogsoft Teams Integration Flow package. Wait for the package to finish uploading.

    4. Under the Review Package Content section, click Create as new in the row for "Moogsoft Teams Integration Flow."

    5. In the Import setup window that appears, change the setup type to Create as new.

    6. Click Save.

  3. Create a new connection:

    1. Under Review Package Content > Related resources, click Select during import.

    2. In the Import setup window that appears, click the plus sign (+) next to Create new. This opens up a new page in your browser.

    3. In the new page, click New connection.

    4. Search for the Microsoft Teams connection and select it.

    5. In the pop-up dialog that appears, click Create.

    6. When prompted to pick an account, select the account of the integration user you created.

    7. Confirm that your new connection is listed under the Connections page.

  4. Finish importing the flow package:

    1. In your browser, navigate back to the original Import package page.

    2. Within the Import setup window, select the new connection you just created from the list of connections. If your connection does not appear, refresh the list.

    3. Click Save.

    4. Click Import at the bottom of the page to import the package.

    5. When the package has finished uploading, the following message should appear at the top of the page:

      MSTeamsIntegration_packageimport.png

      Click Open flow. This will take you to a new page in your browser, where you can edit the imported flow.

  5. Add the flow URL:

    1. Within the new page for editing the imported flow, click on the first action in the flow: manual

    2. Copy the HTTP POST URL.

    3. Click the second action in the flow: Initialize variable - Flow URL

    4. In the Value field, paste the HTTP POST URL that you copied.

  6. Add your Incident Management API key to the flow:

    1. Click the third action in the flow: Initialize variable - WebhookApiKey

    2. In the Value field, paste your Incident Management API key.

    3. Click the fourth action in the flow: Initialize variable - CommentApiKey

    4. In the Value field, paste your Incident Management API key.

    5. Save the flow.

  7. Activate the flow:

    1. From the left-hand menu, navigate back to My flows.

    2. Select Moogsoft Teams Integration Flow from the list of flows.

    3. From the menu bar at the top of the page, click Turn on to activate the flow.

  8. Add the integration user and "Incidents" channel to your teams in Microsoft Teams:

    1. Open Microsoft Teams. From the left-hand menu, navigate to Teams.

    2. Add the integration user to all the teams that you want messages to be posted to.

      For instructions on adding a new user to a team, read this topic from the Microsoft Documentation.

    3. Add a new channel called "Incidents" to all the teams that you want messages to be posted to.

      For instructions on adding a new channel to a team, read this topic from the Microsoft Documentation.

      Note

      "Incidents" must be spelled exactly as shown (case-sensitive), or else the integration will not work. If you want to change the channel name to something else, edit the value of the channel_name variable in the outbound webhook payloads.

Configure the CREATE webhook endpoint in Incident Management

Once you have finished configuring the properties in Microsoft Teams, you must create new incident webhook endpoints in Incident Management in order to send data to Microsoft Teams. This section explains how to set up the Microsoft Teams CREATE webhook endpoint, which sends notifications to Microsoft Teams when incidents are processed in Incident Management.

To configure the CREATE webhook endpoint:

  1. Log in to Incident Management and navigate to Integrations > Outbound Integrations > Webhook Endpoint > Incident Webhook Endpoint.

  2. Click Add an Incident Webhook Endpoint and enter "Microsoft Teams CREATE" as the name of the webhook endpoint. Optionally, provide a description.

  3. Complete each section of the webhook endpoint according to the following:

    1. Skip the Triggers section.

    2. Configure the Endpoint:

      1. Set the Request Method to POST.

      2. Set the endpoint URL:

        1. Open Microsoft Power Automate in a new tab of your browser.

        2. Within Power Automate, navigate to My Flows > Moogsoft Teams Integration Flow.

        3. From the menu at the top of the page, click Edit to open the flow.

        4. Click on the first action in the flow: When a HTTP request is received

        5. Copy the HTTP POST URL.

        6. Go back to Incident Management.

        7. In the URL field, paste the HTTP POST URL that you copied.

      3. Make sure that Authorization is set to "No auth."

    3. Specify the Payload Body:

      1. Replace the default payload with the following:

        { 
            "incidentID":"$id", 
            "severity":"$severity", 
            "description":"$description", 
            "services": "$services", 
            "priority": "$priority", 
            "status":"$status", 
            "incidentURL":"$incident_url", 
            "payload_type":"New", 
            "team_name":"$assigned_groups", 
            "channel_name":"Incidents", 
            "assignee":"$assignee" 
        }
        
      2. Scroll up to the top of the page and click Test in the upper right-hand corner. You should see response details and a confirmation that the webhook endpoint is configured correctly.

      3. Make additional payload adjustments according to your business needs. To learn more about fine-tuning your outbound payload, read Configure the CREATE payload body for a webhook endpoint.

    4. Save the webhook endpoint.

Configure the UPDATE webhook endpoint in Incident Management

Next, create a Microsoft Teams UPDATE webhook endpoint, which sends notifications to Microsoft Teams when Incident Management incidents are updated.

To configure the UPDATE webhook endpoint:

  1. Navigate to Integrations > Outbound Integrations > Webhook Endpoint > Incident Webhook Endpoint.

  2. At the far right side of the "Microsoft Teams CREATE" webhook endpoint you just configured, click on the copy icon:

    MicrosoftTeamsCREATECopy.png
  3. Enter "Microsoft Teams UPDATE" for the name of the duplicate webhook endpoint and click Duplicate.

  4. Click on the "Microsoft Teams UPDATE" webhook endpoint to open it.

  5. Click Edit.

  6. Under the Triggers section, select all the conditions that you would like to trigger the webhook endpoint except for "Comments updated."

    If you want to send comments bidirectionally between Incident Management and Microsoft Teams, follow the instructions in Configure bidirectional comments for Microsoft Teams.Configure bidirectional comments for Microsoft Teams

  7. Skip to the Payload Body section:

    1. Replace the existing payload with the following:

      {
          "incidentID":"$id", 
          "severity":"$severity", 
          "description":"$description", 
          "services": "$services", 
          "priority": "$priority", 
          "status":"$status", 
          "incidentURL":"$incident_url", 
          "payload_type":"Updated", 
          "team_name":"$assigned_groups", 
          "channel_name":"Incidents", 
          "assignee":"$assignee" 
      }
    2. Scroll up to the top of the page and click Test in the upper-right corner. You should see response details and a confirmation that the webhook endpoint is configured correctly.

    3. Make additional payload adjustments according to your business needs. To learn more about fine-tuning your outbound payload, read Configure the UPDATE payload body for a webhook endpoint.

  8. Save the webhook endpoint.

Configure the Comments webhook endpoint in Incident Management

Create a Microsoft Teams Comments webhook endpoint, which sends notifications to Microsoft Teams when new comments are left on Incident Management incidents.

To configure the Comments webhook endpoint:

  1. Navigate to Integrations > Outbound Integrations > Webhook Endpoint > Incident Webhook Endpoint.

  2. At the far right side of the "Microsoft Teams CREATE" webhook endpoint that you have configured, click on the copy icon:

    MicrosoftTeamsCREATECopy.png
  3. Enter "Microsoft Teams Comments" for the name of the duplicate webhook endpoint and click Duplicate.

  4. Click the "Microsoft Teams Comments" webhook endpoint to open it.

  5. Click Edit.

  6. Under the Triggers section, enable Comments updated. Leave all other options disabled.

    Important

    Make sure that "Comments updated" is also disabled for the "Microsoft Teams UPDATE" webhook endpoint you configured for the base integration.

  7. Skip to the Payload Body section:

    1. Replace the existing payload with the following:

      {
          "incidentID":"$id",
          "severity":"$severity",
          "description":"$description",
          "services": "$services",
          "priority": "$priority",
          "status":"$status",
          "incidentURL":"$incident_url",
          "payload_type":"Comment",
          "team_name":"$assigned_groups",
          "channel_name":"Incidents",
          "assignee":"$assignee",
          "comment_by": "$last_comment.created_by",
          "comment": "$last_comment.comment"
      }
    2. Scroll up to the top of the page and click Test in the upper right-hand corner. You should see response details and a confirmation that the webhook endpoint is configured correctly.

    3. Make additional payload adjustments according to your business needs. To learn more about fine-tuning your outbound payload, read Configure the UPDATE payload body for an incident webhook.Configure the UPDATE payload body for an incident webhook

  8. Save the webhook endpoint.

Configure the CREATE workflow in Incident Management

Configure an incident workflow called Microsoft Teams CREATE Workflow, which triggers the "Microsoft Teams CREATE" webhook endpoint when an incident is created in Incident Management.

To configure the CREATE workflow:

  1. Log into Incident Management and navigate to Correlate & Automate > Workflow Engine > Incident Workflows.

  2. Click Add Workflow and enter "Microsoft Teams CREATE Workflow" as the name of the workflow. Optionally, provide a description.

  3. For the Trigger, select New incidents only.

    If preferred, add a filter condition on the incidents that you want to forward to Microsoft Teams.

  4. Add a Send to Endpoint action to the workflow and configure the fields as follows:

    • Webhook: Select the "Microsoft Teams CREATE" incident webhook endpoint that you created earlier.

    • External Link: Skip this section.

    • Integration Name: Enter the following (without quotes): "Microsoft Teams Integration"

      Skip all remaining sections.

  5. Save and Enable the workflow.

Configure the UPDATE workflow in Incident Management

Configure a second incident workflow called Microsoft Teams UPDATE Workflow, which triggers the "Microsoft Teams UPDATE" webhook to send data when an incident is updated in Incident Management.

To configure the UPDATE workflow:

  1. Navigate to Correlate & Automate > Workflow Engine > Incident Workflows.

  2. Click Add Workflow and enter "Microsoft Teams UPDATE Workflow" as the name of the workflow. Optionally, provide a description.

  3. For the Trigger, select Changed incidents only.

  4. Add a Send to Endpoint action to the workflow and configure the fields as follows:

    • Webhook: Select the "Microsoft Teams UPDATE" incident webhook endpoint that you created earlier.

    • External Link: Skip this section.

    • Integration Name: Enter the following: "Microsoft Teams Integration"

      Skip all remaining sections.

  5. Save and Enable the workflow.

Configure the Comments workflow in Incident Management

Next, configure a workflow called Microsoft Teams Comments Workflow, which triggers the "Microsoft Teams Comments" webhook endpoint to send data when an incident is commented on in Incident Management.

To configure the Comments workflow:

  1. Navigate to Correlate & Automate > Workflow Engine > Incident Workflows.

  2. Click Add Workflow and enter "Microsoft Teams Comments Workflow" as the name of the workflow. Optionally, provide a description.

  3. For the Trigger, select Update.

  4. Click Add Action, select the Send to Endpoint action and then click Add Selected Action.

  5. Select the new Send to Endpoint action and complete each section as follows:

    1. Webhook: Select the "Microsoft Teams Comments" incident webhook endpoint that you created earlier.

    2. External Link: Skip this section.

    3. Integration Name: Enter the following: "Microsoft Teams Integration"

      Skip all remaining sections.

  6. Save and Enable the workflow.

Test the integration

  1. Navigate to Integrations > Ingestion Services > Events API.

  2. Add your API key to the provided cURL command and run the command in an external terminal to send an event to Incident Management.

  3. Verify that an incident has been created in Incident Management.

  4. Within Microsoft Teams, verify that an incident notification has arrived.

  5. If you have enabled updates and included Status changed as a trigger, close the incident in Incident Management and verify in Microsoft Teams that an update notification has arrived.