Defining Actions

Defining Actions

Actions are initiated based on specific conditions and can execute a variety of tasks. The first step in configuring an Action is to specify the desired action. Below are the different types of actions available:

Push Notification to myself

This action can notify you on your account via the Admin on your browser or through the TagoIO app. You can customize the title and content of the notification. In the message field, you can use variables to dynamically include information in your text. For more details on how to use message variables, refer to the section "Message Variables" at the end of this page.

Please note that the notification is only sent to the account where it was created. 


Push Notifications to Run Users

Send notifications to designated Run Users within your Run. You must specify the particular Run User you wish to notify. For notifying multiple users, please refer to our documentation on notifications using analysis

In the message field, you can use variables to dynamically include information in your text. For more details on how to use message variables, refer to the section "Message Variables" at the end of this page.


Send Email

Sends an email to a specified address when certain conditions are met. You can specify one or multiple recipients by separating email addresses with a semicolon (;). 

In the message field, you can use variables to dynamically include information in your text. For more details on how to use message variables, refer to the section "Message Variables" at the end of this page.


Warning
Attention: starting January 1st, 2025, TagoIO will discontinue its email services. We recommend integrating with external providers to send emails using the "Send Email using SMTP/SendGrid" action.

Send Email using SMTP

An email will be sent via SMTP when a specific condition is met. This action allows you to send emails via external providers. To configure this action, you need to create a Secret of type SMTP to authorize TagoIO to connect to your email provider and send emails, you will need to supply the server address, port number, username, and password. This information is usually provided by your email hosting service. Learn here how to create this secret: Secrets.

In the message field, you can use variables to dynamically include information in your text. For more details on how to use message variables, refer to the "Message Variables" section at the end of this page.



Idea
Check out our SDK to learn how to send emails using the SMTP protocol in your Analysis code: SMTP | TagoIO SDK for JavaScript and TypeScript

Send Email with SendGrid

An email will be sent via SendGrid when a specific condition is met. To configure this action, you need to create a Secret of type "Text" containing the SendGrid API Key. Ensure that the SendGrid API Key is set in TagoIO Secrets beforehand so it appears in the dropdown menu. Learn here how to create this secret: Secrets



Idea
Check out our SDK to learn how to send emails using SendGrid in your Analysis code: Sendgrid | TagoIO SDK for JavaScript and TypeScript

Send Message to AWS SQS

This action sends messages to Amazon SQS when triggered. It requires authentication via Secrets. You will need to provide the region, queue URL, and access key id and secret access key. Learn how to create this secret here: Secrets.



Send SMS

Sends SMS messages when certain conditions are met. You can specify one or multiple recipients by separating phone numbers with a semicolon (;). You need to include the country code with each phone number. If a country code is not provided, the system will automatically assume the USA code (+1).

In the message field, you can use variables to dynamically include information in your text. For more details on how to use message variables, refer to the section "Message Variables" at the end of this page.



Some costs may occur when using the SMS service, which varies based on the country of operation. Check the pricingterms of use, and your plan before using the SMS service.

Warning
Attention: starting on November 1st, 2024, TagoIO will no longer offer SMS services. We recommend integrating with external providers to send SMS using the "Send SMS with Twilio" action.

Send SMS with Twilio

Use this action to send an SMS message via Twilio when a specified condition is met. You will need to provide the recipient's phone number, the sender's "from" number, and the message content. The message field supports variables, allowing you to dynamically include information in your text. For more details on how to use message variables, refer to the "Message Variables" section at the end of this page.

Ensure that the Twilio SID and Twilio Auth Token are set in TagoIO Secrets beforehand for them to appear in the dropdown menu. Use a Secret of type Text. Learn how to create this secret here: Secrets.



Notes
If you're using Twilio Long Code for messaging, be aware that it requires a Toll-Free verification process. Please consult Twilio's documentation for instructions on how to verify your phone number before proceeding. Depending on Twilio's rules for your account, the Toll-Free verification may be skipped.

You can send SMS directly from scripts within the Analysis using the Twilio service. Before proceeding, ensure you review Twilio's terms of use and confirm your plan details. You must register your "From" number in the Twilio console before integrating it. The Twilio console also allows you to track SMS delivery status and view message content. Note that TagoIO does not charge for utilizing this third-party Twilio service.

Idea
Check out our SDK to integrate SMS functionality with Twilio into your Analysis code: Twilio | TagoIO SDK for JavaScript and TypeScript

Send WhatsApp message with Twilio

Use this action to send a WhatsApp message via Twilio when a specified condition is met. You will need to provide the recipient's phone number, the sender's "from" number, and the message content. The message field supports variables, allowing you to dynamically include information in your text. For more details on how to use message variables, refer to the "Message Variables" section at the end of this page.

Ensure that the Twilio SID and Twilio Auth Token are set in TagoIO Secrets beforehand for them to appear in the dropdown menu. Use a Secret of type Text. Learn how to create this secret here: Secrets.

You will need to integrate your WhatsApp with the Twilio platform. Check Twilio's documentation here: https://www.twilio.com/docs/whatsapp



You can send WhatsApp messages directly from scripts within the Analysis using the Twilio service. Before proceeding, ensure you review Twilio's terms of use and confirm your plan details. You must register your "From" number in the Twilio console before integrating it. The Twilio console also allows you to track the delivery status and view message content. Note that TagoIO does not charge for utilizing this third-party Twilio service.

IdeaCheck out our SDK to integrate WhatsApp messages functionality with Twilio into your Analysis code: TwilioWhatsapp | TagoIO SDK for JavaScript and TypeScript

Run Analysis Script

Actions have the power to initiate scripts that run in the Analysis. This is a very powerful feature, as you can define exactly when your code will run.

Learn more about Running Analysis via Action.

Publish to TagoIO MQTT Broker

This action can publish to an MQTT topic defined by the developer. This means that every time your trigger criteria are met, TagoIO will publish data to that predefined MQTT topic, this is very useful if you need to forward data to devices and/or applications. 

To set the MQTT action up, select the option Publish to MQTT, select the device which will receive that topic and type in the topic. The content of the MQTT payload that subscribed devices will receive can be defined as well.

Notes
The TagoIO MQTT Broker is accessible for both Starter and Scale accounts.

Post data to HTTP End-Point

This action can post data directly to an endpoint defined by you. When the action is initiated, it will POST the JSON data received (as defined by the variable in the Trigger) to the configured HTTP endpoint address. 

You can use payload fields in the HTTP endpoint, like the example above but with a variable (https://myapi.io/endpoint/$VALUE$), or even in the HTTP Headers like in the example below:

The TagoIO-Retries header is managed by the TagoIO API and sent in every Post request for this Action type, and indicates the number of attempts to post the data to your endpoint.

It will try to post the data 10 times, and if it’s unsuccessful (any response from your endpoint other than HTTP 20X status codes) it will require a fallback device to be configured to store the data in TagoIO so you can retrieve it later without losing your data in case your endpoint fails to receive it.

To set up a fallback device, enable it in the bottom part of the HTTP Post action settings and put the token for the device you intend to hold the data.

After 10 unsuccessful attempts, the data will be sent to the fallback device with some information added to the metadata in the _http_* properties (original values in metadata will be kept), like shown below:


Insert to Device's data storage

This option is only available if your Action is of the type MQTT Topic.  This action will insert the data directly into the device's data storage.


Message Variables

In some action types, the message body can be as simple as a text like Hi, your car is over the speed limit or you can specify fields in the message to personalize it with real-time data from your  devices.

You can use most of the payload fields from our API:

$VARIABLE$Variable name
$VALUE$Variable value
$UNIT$Unit of your variable
$TIME$Time the variable was received
$LOCATION$Location value
$DEVICE$Device ID
$DEVICE.NAME$Name of your device
$ACTION.STATE$Current state of your Action: locked or unlocked

For example, a personalized message like this
  • Hi, your device reached $VALUE$ $UNIT$ at the coordinates $LOCATION$ at $TIME$.
This would result in the message being:
  • Hi, your device reached 73 mph at the coordinates 43.05334,-86.45340
And a message like this
  • $TIME$: Warning, device with ID $DEVICE$ is $VARIABLE$° $UNIT$.
Would result in the following message:
  • 2021-01-02T22:51:48.005Z: Warning, device with ID 547e353d7dbf3af122c0257d is 90° F.



    • Related Articles

    • Actions

      Actions is a very powerful feature that gives you total control over your devices based on events determined by you. With Actions you can: Send an SMS based on certain conditions; Send an Email based on certain conditions; Run scripts using Analysis; ...
    • Secrets

      Secrets are encrypted environment variables that can be used to store sensitive information, such as passwords and API keys. You set a key and a value for your secret: the key serves as the name of the secret, while the value contains your sensitive ...
    • SMS Service

      Each time an SMS message is successfully sent by an Action or Analysis function, it is counted as one SMS unit sent. The service limit defined inside each Profile determines the maximum number of SMS that can be sent during a one month period (based ...
    • Connecting your MQTT Broker to TagoIO

      TagoIO supports MQTT connections through our MQTT Relay command-line tool. This software acts as a bridge between your MQTT Broker and the TagoIO platform, facilitating seamless integration and data flow. Developed in Rust, the TagoIO MQTT Relay is ...
    • MQTT - Process data, Publish it and Subscribe to a topic

      Starting on June 1st, TagoIO will no longer provide MQTT broker to Free accounts. Read more In this tutorial, you will learn how to process data, publish to a topic, and subscribe to it. We will be using the MQTTX client throughout this tutorial. ...