Microsoft Teams for Workflows
Your Dynatrace environment can integrate with Microsoft Teams channels in automation workflows.
Integrate Microsoft Teams with Dynatrace workflows
Install the Dynatrace app
Allow Microsoft Teams for outbound connections
Create an incoming webhook
Insert the URL webhook
Install the Dynatrace app
To use Microsoft Teams workflow actions, you first need to install the Microsoft Teams for Workflows app from Dynatrace Hub.
- In Dynatrace Hub
, search for Microsoft Teams for Workflows.
- Select the Microsoft Teams for Workflows app and select Install.
After you install Microsoft Teams for Workflows, you need to perform some initial steps to set up the connection between Microsoft Teams and your Dynatrace environment.
Allow Microsoft Teams for outbound connections
Allow outbound connections for the Microsoft Teams instance that is used for receiving messages.
-
Open Settings
and go to Preferences > Limit outbound connections.
-
Select Add item and add the domain of your publicly accessible Microsoft Teams instance.
For example,
*.webhook.office.com
can be used as a domain on the Limit outbound connections page to allow sending messages to all Microsoft Teams instances. The specific domain can also be inferred when creating the webhook (see next step). -
Select Save changes.
Create an incoming webhook
To create an Incoming Webhook in the Microsoft Teams channel
-
In Microsoft Teams, right-click on the Microsoft Teams channel and select Connectors.
-
In the Incoming Webhook row, select Configure.
-
Complete the details.
-
Copy the generated URL.
You will need the URL in the next procedure.
Insert the webhook URL
Insert the URL as Webhook URL in the Microsoft Teams for Workflows app settings.
- In the Dynatrace menu, go to Settings and select Dynatrace Apps > Microsoft Teams Connections.
- Open or create (Add item) a connection configuration.
- In Webhook URL on the configuration page for the connection, paste the URL you generated in the previous procedure. If you are adding a new connection, you also need to give the connection a name.
- Select Save changes.
Use workflows with Microsoft Teams
The workflow action can be used to send Markdown-formatted cards or AdaptiveCard format.
Inputs
- Connection: the Webhook connection used for sending messages.
- Message: Markdown-formatted text or the output of the AdaptiveCard designer or input from another action producing such a format.
Input examples
-
Connection: select any connection from the dropdown list (for example,
dynatrace-notifications-sandbox
). -
Message: see the examples in the following table.
Input type Sample input Markdown
**Hello World** This is Markdown-formatted text!
AdaptiveCard
{ "type": "AdaptiveCard", "actions": [], "body": [ { "type": "TextBlock", "size": "Medium", "weight": "Bolder", "text": "Hello World" } ], "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", "version": "1.4" }
Automation expression
{{ result("build_ms_teams_message_action") }}
-
Interactions
Select Send test message (under the input field) to send a test message. However, if the message contains any automation expression, the expression will not be processed but sent as is.
-
Output: The action does not have any output besides logs.
-
Log output examples
- Successful:
[INFO] POST https://xxxxxxx.webhook.office.com/*** called successfully [INFO] Message has been posted successfully
- Error:
[ERROR] Received unexpected HTTP Response from API: 503 Service Unavailable [ERROR] POST https://xxxxxxxx.webhook.office.com/*** Unable to communicate with the Teams API: Encountered unknown HTTP status code 503 - Service Unavailable
- Successful:
Example 1: on demand
To create a workflow that sends a message on demand to a Microsoft Teams channel
-
Open Workflows
and select
to create a new workflow.
-
In the side panel, select On demand trigger.
-
On the trigger node, select
to browse available actions.
-
In the side panel, search the actions for Microsoft Teams for Workflows and select Send message.
-
In the side panel
- Select a preconfigured Microsoft Teams Connection.
- Type or paste the Message to send to the channel.
-
Select Save.
If you Run the workflow successfully:
- The Message you defined is sent to the selected Microsoft Teams channel.
- The Detail tab in the side panel displays the State value
Success
.
Example 2: fixed time trigger
To create a workflow that sends a daily reminder at a fixed time to a Microsoft Teams channel, you just need to slightly modify the trigger in the previous procedure.
With the previous workflow displayed in your editor
-
Select the current trigger (On demand trigger).
-
In the side panel, select Change trigger.
-
In Select a trigger, select Fixed time trigger.
-
Define when to send the message.
- Set Run at to the time of day at which to send the message.
- Set Rule to
Every working day
.
-
Select Save.
If you Run the workflow successfully:
- The Message you defined is scheduled to be sent to the selected Microsoft Teams channel at the specified time every day.
- The Detail tab in the side panel displays the State value
Success
.
Example 3: AdaptiveCard format
If you use the previous example but paste the following into Message, the message "Daily reminder test - AdaptiveCard format" with the defined formatting will be sent out daily at the time defined in the trigger.
{
"type": "AdaptiveCard",
"actions": [],
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Daily reminder test - AdaptiveCard format"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4"
}
Troubleshooting
The following are solutions to problems some people had with Microsoft Teams for Workflows actions.