Microsoft Teams connector and action

edit

Microsoft Teams connector and action

edit

The Microsoft Teams connector uses a webhook to send notifications.

Connector configuration

edit

Microsoft Teams connectors have the following configuration properties.

Name
The name of the connector. The name is used to identify a connector in the management UI connector listing, or in the connector list when configuring an action.
Webhook URL
The URL of the incoming webhook. Refer to Configure a Microsoft Teams account. If you are using the xpack.actions.allowedHosts setting, make sure the hostname is added to the allowed hosts.

Connector networking configuration

edit

Use the Action configuration settings to customize connector networking configurations, such as proxies, certificates, or TLS settings. You can set configurations that apply to all your connectors or use xpack.actions.customHostSettings to set per-host configurations.

Preconfigured connector type

edit
 my-teams:
   name: preconfigured-teams-connector-type
   actionTypeId: .teams
   secrets:
     webhookUrl: 'https://outlook.office.com/webhook/abcd@0123456/IncomingWebhook/abcdefgh/ijklmnopqrstuvwxyz'

Secrets defines sensitive information for the connector type.

webhookUrl
A string that corresponds to Webhook URL.

Define connector in Stack Management

edit

Define Teams connector properties.

Teams connector

Test Teams action parameters.

Teams params test

Action configuration

edit

Microsoft Teams actions have the following properties.

Message
The message text, converted to the text field in the Webhook JSON payload. Currently only the text field is supported. Markdown, images, and other advanced formatting are not yet supported.

Configure a Microsoft Teams account

edit

Microsoft 365 connectors are being retired; you must use the Workflows app to create a webhook URL. For example:

  1. Go to the Workflows app in Teams and select the Create tab.
  2. Create a workflow from a blank template.

    You cannot use the "Post to a channel when a webhook request is received" template; it does not work with the Microsoft Teams connector.

  3. Add a trigger as the first step in the workflow. Search for webhook triggers and select When a Teams webhook request is received. Set Who can trigger the flow? to Anyone.
  4. Add Post message in a chat or channel as the second step in the workflow.

    1. Set Post as to Flow bot.
    2. Set Post in to Channel.
    3. Set Team and Channel to the appropriate values for where you want the message displayed.

    4. Set the Message to @{triggerBody()?['text']}.

      Alternatively, you can add a Parse JSON step before the Post message in a chat or channel step in the workflow. Set the Content to Body and the Schema to the following value:

      {
          "type": "object",
          "properties": {
              "text": {
                  "type": "string"
              }
          }
      }
  5. Save the workflow and copy the HTTP POST URL from the first step. This is the URL required by the Microsoft Teams connector.