The 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.
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 with an Analysis template that 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.
- Go to your account settings by clicking on the upper corner of TagoIO page and enter My Account.
- Select your Profile in the sidebar.
- Go to the Tokens Section, create a new token with Expire In set to "Never" and copy the Token.
- Install the Analysis Template.
- Go to the Environment Variables of your analysis.
- Replace the field value "Your Account Token Here" with the token you copied in step 3.
- 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.
- 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.
- 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.
"title": "title of your notification",
"message": "message of your notification",
"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": "analysis to run when clicked"
"buttons_autodisable": true // auto disable the buttons when one is clicked.