Analysis is always a powerful tool when it comes to TagoIO, and that does not change for Notifications. Here you will learn how to send a notification for your TagoRun users using Analysis, how to use buttons, and how to handle user decisions over your notification.


Customized Notifications

When sending a notification using Analysis, the immediate features available are buttons. You can have up to four different buttons in your notification. There are different behaviors you can set a button to do:

  • Redirect to a TagoIO page.
  • Redirect to an external link.
  • Trigger an Analysis when pressed.

You also have a few customizable options:

  • Set the button label.
  • Set the button color. 

How to Setup an Analysis

We provide you an Analysis template which will have a code for a demonstration. The following analysis does send a notification to all your users with given tags. 

Follow these instructions to setup your analysis and send the notifications. You can make any change to the analysis after it is installed in your account, to properly fit your needs.

  1. Go to your account settings by clicking on the upper corner of TagoIO page and enter My Account.
  2. Select your Profile in the sidebar.
  3. Go to the Tokens Section, create a new token with Expire In set to "Never" and copy the Token.
  4. Install the Analysis Template.
  5. Go to the Environment Variables of your analysis.
  6. Replace the field value "Your Account Token Here" to the token you copied in step 3.
  7. Fill the field value for tag key and tag value to match at least one of the tags of your users in the User Management.
  8. If you didn't setup a tag for any of your users, go to  User Management, enter one of your users and create a tag key and value in the Tags section.
  9. Press Save and Run to start your analysis and send a notification to your users.

With this all up and running, you can open the script of your analysis and start to change it as needed. The code is fully commented on and detailed to guide you.

You can also create an Action to trigger the Analysis or set it to run every X minutes.


The Notification Object

You will notice it in the Analysis code, this is a quick copy and paste for you to use.

{
    "run_user": "run_user_id",
    "title": "title of your notification",
    "message": "message of your notification",
    "buttons": [{
        "label": "label of the button",
        "id": "id_of_the_button", // no space allowed
        "color": "color of the button",
        "url": "url to redirect the user",
         "analysis_id": "analysis to run when clicked"
    }],
    "button_autodisable": true // auto disable the buttons when one is clicked.
}