Send an alert to Microsoft Teams channel
You can integrate Synerise with Microsoft Teams using a dedicated node to build a variety of business scenarios. One of them is building a workflow that sends messages to a Microsoft Teams channel based on metrics, expressions, reports or any other analyses created in Synerise. Sending alerts can be additionally dependent on the value of these analyses and you can send messages if the value of the analyses is greater or lower than a specific number.
This particular use case uses a metric which analyzes percentage decline of transactions every day. If the number of transactions decreased the day before by 50% compared to the average for the last 30 days, the message with alert is sent to a specific channel on Microsoft Teams. The message to the channel contains information with the value of the metric.
Prerequisites
- Implement transaction events using SDK or API.
- Create a workflow from a channel in Teams by following steps below (skip point 4):
- Go to Power Automate to create a workflow from a channel in Teams. Save workflow to generate incoming webhook URL.
- Edit the created workflow by filling out the TeamId and ChannelId fields. These values will be suggested. If not:
- To get the value of TeamId, go to the MS Teams application and retrieve a link to the team. TeamId is the part of generated URL groupId=XXXX.
- To get the value of ChannelId, go to the MS Teams application and retrieve a link to the channel. ChannelId is a part of generated URL channel/XXXXXXXX.
- Save the changes in the workflow.
- If you want to send an interactive message (such message can contain links, simple surveys, sections), prepare it in AdaptiveCard.
Process
In this use case, you will go through the following steps:
- Create a metric which counts the change in transactions. It calculates percentage change in transactions the day before compared to the daily average for the last 30 days.
- Create a workflow which sends the message to the Microsoft Teams channel.
Create a metric which counts the change in transactions
In this step, we will create the metric, whose result will be later sent in the Microsoft Teams message. This specific metric will count the change in the amount transaction.charge events in comparison to the average from previous 30 days. The result of the metric will be expressed as a percentage. The message to the channel will contain information with the value of the metric.
-
In Synerise, go to Analytics > Metrics > New metric.
-
Enter the name of the metric.
-
Choose the Formula metric.
-
Build the formula of the metric as shown in the screen below:
Where:
- The time range for the first
transaction.charge
event (on the left side) is set to Last 1 day before 1 day. - The time range of the second
transaction.charge
event (in the middle) is set to Last 30 days before 2 days. - The time range of the third
transaction.charge
event (on the right side) is set to Last 30 days before 2 days.
- The time range for the first
-
Confirm by clicking Apply.
Results: The results will show by how many percent transaction events increased or decreased in comparison to the average from previous 30 days.
Create a workflow
In this part of the process, you will create a workflow that sends a message to the Microsoft Teams channel if the number of transaction events decreased more than 50% comparing to the average in previous 30 days.
- In Synerise, go to Automation > Workflows > New workflow.
- Enter the name of the workflow.
Configure the trigger
As the first node, select the Scheduled Run node in which you will define the frequency of triggering this workflow and schedule the start of the workflow.
- Start with the Scheduled Run node. In the configuration of the node:
- Set the Run trigger option to all time.
- Select the Everyday tab.
- Select the time zone.
Important: Select the time zone consistent with the time zone selected for your workspace.
- Select the time when the workflow will be launched.
- Confirm by clicking Apply.
Configure the Metric Filter
In the Metric Filter node, you will select the metric prepared in the previous part of the process. The continuation of the workflow will depend on the result of the metric. If the metric result is lower than 50, the alert about significant transaction events decrease will be sent to a Microsoft Teams channel.
- On the Scheduled Run node, click THEN.
- Choose the metric created in the previous step.
- As the condition, by using the mathematical operators, set the metric result to be less or equal
-50
. - Apply changes.
Configure Microsoft Teams Integration node
In this step, you will configure the settings of the outgoing integration that sends the message to the Microsoft Teams channel.
Create a connection
- On the Metric Filter node, click THEN.
- From the dropdown list, select Microsoft Teams > Send Channel Message.
- In the configuration of the node:
- If you already create a connection, select the connection from the list.
- If you haven’t created any connection yet:
- At the bottom of the dropdown list, click Add connection.
- In the Incoming Webhook URL field, enter the incoming webhook URL you created as a part of prerequisites.
- Click Next.
- In the Connection name field, enter the name for the connection you created.
- Click Apply.
Result: A connection is created and selected.
Define the integration parameters
- In the Type of message dropdown list, select the Simple message.
- In the Text of message field, enter the text of message that will be sent to Microsoft Teams channel. In the message, you can insert the result of metric created in the previous step. This way the result of the metric will be sent to the Microsoft Teams.
See the example message with metric insert:
Check the transaction level! It decreased for more thank 50% comparing to the average from last 30 days. The metric result is: {% metricsvar metric_id:78d31e68-d886-4fcb-9ca3-b2136e74be01 %}{{ metric_result }}{% endmetricsvar %}%.
Add final setting to your workflow
- Add the End node.
- Launch the workflow by clicking Save&Run.
Result: The message is sent to the Microsoft Teams channel.
Check the use case set up on the Synerise Demo workspace
Directly in our Synerise Demo workspace, you can check the configuration of the metric which counts the percentage change in transaction events and the workflow configuration.
If you don’t have access to the Synerise Demo workspace, please leave your contact details in this form, and our representative will contact you shortly.