Automate alerts with Power Automate

From SpinetiX Support Wiki

Jump to: navigation, search

Introduction

This tutorial focuses on automating alerts within ARYA by leveraging Power Automate to create an automation API. Power Automate, formerly known as Microsoft Flow, is a cloud-based service and workflow automation tool provided by Microsoft as part of the Microsoft Power Platform. It enables users to create automated workflows and tasks across various Microsoft and third-party applications.

Automating alerts within ARYA streamlines the process of managing alerts by automatically activating and deactivating them based on predefined conditions. This integration ensures timely notifications and reduces the need for manual intervention, thus enhancing the efficiency of monitoring and response systems.

Tutorial

This walkthrough outlines the process of automating alerts within ARYA using Power Automate. Automating ARYA alerts using Power Automate involves creating flows and setting various types of input triggers. Input types for manual triggers can include text, number, yes/no, file, email, date, and many more. In this tutorial, we will be creating a simple flow using a button (yes/no) as the trigger. This guide offers a comprehensive step-by-step approach to setting up alert automation utilizing Microsoft Power Automate, specifically by employing the Automation API to activate and deactivate alerts.

Requirements

Get the necessary information

To set up the automation in Power Automate, you'll create a flow with a webhook request. You'll need the following URL and the specific values highlighted in red:

https://arya.services.spinetix.com/v1/alerts/ALERTID/state?apiKey=APIKEY&accountId=ACCOUNT

The values you need are ALERTID, APIKEY, and ACCOUNT ID. Please follow the instructions below to retrieve them.

Set up an Alert
ARYA Alert

The first thing to do is set up the alert that you want to use. For this tutorial, we will use the Fire Alert. However, feel free to select a different alert or create a new one if you prefer.

  1. Go to https://arya.spinetix.cloud/.
  2. Log in to your account.
  3. Navigate to the main menu on the left and go to ALERTS.
  4. Select the Fire Alert.
Note Note:
For more information on how to setup Alerts, please click here.
Choose the players on which the alert will show

The next step is to choose the players to which you want to send the alert and have it show.

ARYA Alert activation

This is done by selecting the target player(s), activating and then deactivating the alert. For this tutorial we will send the alert on all players, but the alert can instead be sent to groups of players, or only specific ones.

  1. On the right, click on the plus (+) sign and select ALL PLAYERS.
  2. Click ACTIVATE. This will save the list of selected players, send and activate the alert on all your player(s); you should now see the alert displayed on your screen(s).
  3. Go back to the ALERTS page.
  4. Select the alert and on the right, click on DEACTIVATE to stop showing the alert; we will activate it again via Power Automate later.
Get the Alert ID
ARYA API Key
  1. After completing the activation and deactivation process, select and open the desired alert by clicking on the edit icon.
  2. In your browser's address bar, locate and copy the alert's ID.
Note Note:
The alerts' ID is the value between "project-edit/" and "/edit-frame".
Get your ARYA API Key
ARYA API Key
  1. On the top left, Go to Settings > API
  2. Click on Generate new API key on the right.
Note Note:
Generating a new API key will render the previous key generated invalid. For a full guide on how to generate a new ARYA API key please click here.
Get your ARYA account ID
ARYA account ID
  1. On the top left, Go to Settings > Account Info
  2. Copy the value under ACCOUNT ID
Prepare the URL

With the values that you have obtained, use a text editor (Notes, Sticky Notes, Word) and prepare the URL by inserting the values that you have obtained, for instance:

https://arya.services.spinetix.com/v1/alerts/5xOwWYtmlKYWft0EAPkQTSv2G9ixzAbeO/state?apiKey=QjVSfYNUYoYiqJCkH8Gh&accountId=rpj9h4SJsJfvmAXF3A2W0Cxkrrs1BcjZRn 

You will need this URL in a later step in the Power Automate guide below.

Power Automate

Now that you have all the necessary information for the setup, It's time to and create a simple flow in Power Automate. Follow these steps to create a simple Flow with a manual trigger in Microsoft Power Automate to activate or deactivate an Alert in ARYA.

  1. Go to your Microsoft 365 portal and log in if needed.
    • Then, using the search bar, search for Power Automate and select it.
    • Or, go to the App launcher on the top left, click on Explore all your Apps, Scroll down and select Power Automate.
  2. Click Create on the menu on the left column then select Instant cloud flow.
    Instant cloud flow.Jpg
  3. Choose the first trigger on the list Manually trigger a flow and click Create.
    Manual trigger.Jpg
  4. On the top left, click on Untitled and give your flow a name. In this case, We named the flow Activate ARYA Alert.
    Flow rename.Jpg
  5. Click on the trigger and click Add an input.
    Add Input.Jpg
  6. For activating and deactivating an alert we need a boolean input, so we select Yes/No as the input type.
    Input type.Jpg
    • You can edit the Trigger title and description if you like or leave it as it is. For this tutorial we have name the trigger title "Activate" and the description "Activate Alert".
      Step rename.jpg
  7. Add a new step to the flow, click on the plus + button and then on Add an Action .
    Add step.Jpg
  8. On the search box, type HTTP and select HTTP.
    HTTP flow.Jpg
  9. In the HTTP request fields. you will need to fill in the URI, Method and Body fields. The HTTP request is the command that we will be sending to ARYA (Activate/Deactivate an alert).
    HTTP request.Jpg
    • URI: Use the URL that you have prepared in the previous section.
    • Method: The method to use here is PUT as we are requesting to Activate or Deactivate an Alert in ARYA.
    • Body: Type { "enabled": }, then hover your mouse to the right of the text field, after the :, select the lightning bolt, and choose the trigger value. This will enable the alert when the "Activate" toggle is enabled in the trigger and deactivate when not. For more details, refer to the API documentation on how to structure the request body.
    • Once you are done, click on Save.

Testing the automation

Now that you have set up a Flow in Power Automate, it is time to put it to the test. For the convenience of users, this tutorial demonstrates the testing process using the Power Automate mobile app. This approach allows for easy execution of the automation anytime, anywhere, directly from a mobile device.

  1. Download and Install the Power Automate mobile app.
  2. Login with your Microsoft 365 Account.
  3. Once logged in, you will see the list of flows created in your account.
  4. To run a flow, click on the three dots on the right of the flow → Run flow.
    • Or alternatively, click on the flow and click the PLAY button on the top right.
  5. Next, toggle on Activate to activate the alert and click on Run flow.
    • After running the flow, you will be back on the home screen and a message stating "Flow ran successfully" will appear briefly.
  6. Check your screens, the Fire Alert should now be showing on all players.
    • You can also go to your ARYA account, schedule page, select on of the target player(s) and verify if the alert is showing by looking at the snapshot.
      Alert activated in ARYA
  7. Next, to deactivate the alert. Toggle off Activate in the Power Automate app and click on Run flow.
    • The Fire Alert should now stop showing on all players.
    • You can also go to your ARYA account, schedule page, select on of the target player(s) and verify if the alert is no longer showing by looking at the snapshot.

Congratulations! You've effectively established an automation to trigger alerts in ARYA using Power Automate.

Note Note:
If the alert is not showing on the player snapshot in ARYA's schedule page, go back to the power automate app and click on the run to identify the issue. Power Automate provides detailed insights where the problem occurred. Additionally, you will find error details displayed for your reference.

Conclusion

This tutorial has demonstrated the integration between ARYA and Power Automate for automating alerts. By following the outlined steps, users can efficiently set up and manage alerts with minimal manual intervention.

Automating ARYA alerts with Power Automate can be extended to various scenarios, such as automatically triggering alerts based on email conditions, scheduled calendar events, or even specific data inputs from other connected applications. Your imagination is the limit!

See also

This page was last modified on 30 July 2024, at 14:32.