Send a Microsoft Teams message using an Incoming Webhook.

Add this task to a list of errors tasks to implement custom flow-level failure noticiations. Check the Microsoft Teams documentation for more details.

yaml
type: "io.kestra.plugin.notifications.teams.teamsincomingwebhook"

Send a Microsoft Teams notification on a failed flow execution

yaml
id: unreliable_flow
namespace: company.team

tasks:
  - id: fail
    type: io.kestra.plugin.scripts.shell.Commands
    runner: PROCESS
    commands:
      - exit 1

errors:
  - id: alert_on_failure
    type: io.kestra.plugin.notifications.teams.TeamsIncomingWebhook
    url: "{{ secret('TEAMS_WEBHOOK') }}" # format: https://microsoft.webhook.office.com/webhook/xyz
    payload: |
        {
          "type": "message",
          "attachments": [
            {
              "contentType": "application/vnd.microsoft.card.adaptive",
              "content": {
                "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                "type": "AdaptiveCard",
                "version": "1.4",
                "body": [
                  {
                    "type": "TextBlock",
                    "size": "Large",
                    "weight": "Bolder",
                    "text": "Kestra Execution Notification"
                  },
                  {
                    "type": "TextBlock",
                    "text": "Execution ID: `{{ execution.id }}`",
                    "wrap": true
                  },
                  {
                    "type": "TextBlock",
                    "text": "Flow: `{{ flow.id }}` in namespace `{{ flow.namespace }}`",
                    "wrap": true
                  },
                  {
                    "type": "TextBlock",
                    "text": "Status: **{{ execution.state }}**",
                    "wrap": true
                  }
                ],
                "actions": [
                  {
                    "type": "Action.OpenUrl",
                    "title": "View Execution",
                    "url": "{{ kestra.url }}/ui/executions/{{ flow.namespace }}/{{ flow.id }}/{{ execution.id }}"
                  }
                ]
              }
            }
        ]
        }

Send a Microsoft Teams notification message.

yaml
id: "teamsincomingwebhook"
type: "io.kestra.plugin.notifications.teams.teamsincomingwebhook"
url: "https://microsoft.webhook.office.com/webhookb2/XXXXXXXXXX"
payload: |
  {
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "0076D7",
    "summary": "Notification message",
    "sections": [{
      "activityTitle": "Rolling Workflow started",
      "activitySubtitle": "Workflow Notification",
      "markdown": true
    }],
    "potentialAction": [
      {
        "@type": "OpenUri",
        "name": "Rolling Workflow",
        "targets": [
          {
           "os": "default",
           "uri": "{{ vars.systemUrl }}"
          }
        ]
      }
    ]
  }
Properties
Min length 1

Microsoft Teams incoming webhook URL

Options

The options to set to customize the HTTP client

Microsoft Teams message payload

Format duration

The time allowed to establish a connection to the server before failing.

Default PT0S
Format duration

The time an idle connection can remain in the client's connection pool before being closed.

Default UTF-8

The default charset for the request.

SubType string

HTTP headers

HTTP headers to include in the request

Default 10485760

The maximum content length of the response.

Default PT5M
Format duration

The time allowed for a read connection to remain idle before closing it.

Default PT10S
Format duration

The maximum time allowed for reading data from the server before failing.