Skip to content

Teams Webhook Walkthrough

Use case: When a task fails for any batch pipeline in a journey, Observability sends you a detailed message, directly in Microsoft Teams.

Step 1: Create a Microsoft Teams webhook URL

Start by following the instructions outlined in the Microsoft Teams documentation to generate an incoming webhook URL.

The URL will look something like this when you're done: https://m365x012345.webhook.office.com/EXAMPLE

Copy and save the URL to use in the next step.

Step 2: Set up your Observability rule

When you have your personalized Microsoft Teams webhook URL, log into Observability, select your project, and open the Journeys page.

  1. Select the journey you want to define the rule for, then select the Rules tab.
  2. Click Add Rule.
  3. Use the drop-downs to fill in the rule predicate: When task status is Failed for any component in journey.
  4. Click Add Action and select Web Request.
  5. Fill in the Send Web Request fields.

    1. Select POST as the Method.
    2. URL is the URL you copied in Step 1 above.

      For example: https://m365x012345.webhook.office.com/EXAMPLE

    3. Use the following Payload:

      {
        "@context": "http://schema.org/extensions",
        "@type": "MessageCard",
        "sections": [
          {
            "activityTitle": "Failure in task '{task.name}'",
            "facts": [
              {
                "name": "Project",
                "value": "{project.name}"
              },
              {
                "name": "Pipeline",
                "value": "{pipeline.name}"
              },
              {
                "name": "Run",
                "value": "{run.key}"
              },
              {
                "name": "Task",
                "value": "{task.name}"
              },
              {
                "name": "Status",
                "value": "{run_task.status}"
              },
              {
                "name": "Link",
                "value": "https://{company.ui_url}/projects/{project.id}/runs/{run.id}"
              }
            ],
            "markdown": true
          }
        ],
        "summary": "Failure in task {task.name}",
        "themeColor": "f44336"
      }
      
    4. Teams does not require headers for calling its webhook, so leave this field blank.

  6. Click Save.

If tasks fail for the batch pipeline components included in this journey, you'll receive a message directly in Microsoft Teams that includes a link to Observability, so you can take action.

Note

Task status rules only trigger for batch pipeline components.