How-to: Integrate MS Teams

Integrate Microsoft Teams with HCL DevOps Deploy (Deploy) to post notifications automatically to your Teams channel whenever a specific deployment event happens.

About this task

By using the Incoming Webhook connector in Teams, you can integrate Deploy services so that you get notified of an event through the Teams channels.

In this example, you'll learn about the requirements and procedures to integrate Teams with Deploy. To integrating Teams with Deploy, follow the steps provided in this section.

Step 1: Obtain the webhook URL from your Teams channel

Procedure

  1. Open the Teams channel where you want to add the webhook and select (•••) More Options from the top navigation bar.
  2. Choose Connectors from the menu and search for Incoming Webhook.
  3. Select Configure, provide a name, and, optionally, upload an image avatar for your webhook.
  4. Submit the details.
    The dialog box presents a unique URL that will map to the channel. Make sure that you copy and save the URL. You have to provide this URL when you add the webhook to a process.
    The webhook URL looks similar to the following example:
    https://o365.webhook.office.com/webhookb2/00000000-0000-0000-0000-000000000000@00000000-0000-0000-0000-000000000000/IncomingWebhook/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/00000000-0000-0000-0000-000000000000
  5. Select Done.

Results

The webhook is added to the Teams channel and posts a confirmation message like this example:An example of Teams incoming webhook addition
Note: For additional information about Teams webhooks, refer to the MS Teams webhooks documentation.

Step 2: Format the message card

A message card is defined in a JSON format that includes the message in text, links, and image, if required. For HCL DevOps Deploy (Deploy), you can create a message card that refers to the process name, status, and a link to the process deployment page. The message card format is used as body in the webhook template.

About this task

The message cards can be created using the following available templates:

Step 3: Create a webhook template

Create a webhook template for an event so that when the event happens a notification is triggered on Teams.

Procedure

  1. Select Settings > Webhook Templates > Create Webhook Template.
  2. Provide a name and description for the template. For this example, give the name as Process failure notification.
  3. Click on Body area and paste the example code from the step 2.
  4. Choose the event type Process Failure from the Type field.
  5. Submit your changes.

Results

The webhook template is created and ready to be added to an application.

Step 4: Add webhook template to an application

You can add a webhook template to applications, generic processes, and external approval processes. For this example, you add the template to an application.

Before you begin

Make sure that you created an environment for the application and have resources added to it.

Procedure

  1. Select Applications > application name > Configuration > Webhooks > Add Webhook.
    The Add Webhook window is displayed.
  2. Copy the URL generated that was generated in step 1 and paste it in the URL field.
  3. Specify the event type as Process Failure.
  4. Select the template name that you created in step 3 from the Webhook Template field.
  5. Specify the environment name from the Environments field.
  6. Submit your changes.

Results

The webhook template is added to the application. When an application process run on the environment and fails, the Teams channel shows the following notification.

Teams example notification for approval failed event

Webhook-Integration-Test 6/13 6:53 PM
An approval failed for the App application on the Env environment
An application process was rejected during its approval process
Application: App Environment: Env Requested by: admin Scheduled for: Sun Jun 13 18:52:31 IST 2021 Description: ${request.Description}
Click View Details for more information.