Skip to main content

Events: Creating a Context-Based Alert

Learn how to trigger an event using the context of a variable.

Sergio M avatar
Written by Sergio M
Updated yesterday

Take full advantage of your operation’s data by setting up events that trigger based on the context of your variables.

Requirements

  • Account with an active plan.

1. Creating an event with a context-based trigger

1.1. Triggers

To begin, head to the “data” tab →"Events" and hover over the “+” button, located at the upper right corner of the screen, and create a conditional event, global event, or scheduled event depending on your needs.

Once the event modal pops up, you’ll find yourself in the first stage of configuration, where you’ll set up the logic of the triggers. This is where we’ll configure our context-based alert.

1. Click on the “+ add trigger” or “+ add OR group” buttons and select “context based”. By default, a newly created event loads with a value-based trigger created, but you can either delete or configure it as well if it fits your needs.

2. Select one variable per conditional expression. Multiple variables can be added using AND (“+ add trigger”)/OR (“+ add OR group”) conditionals.

3. Enter the context key you want to track. Keep in mind that this field is case sensitive, so make sure you enter the exact key that is sent to your variable’s context.

4. Define the condition of the trigger. These are the available options:

  • Is: The event will be triggered if the key’s value exactly matches the text defined in the following field.

  • Contains: The event will be triggered if the key’s value partially contains the text defined in the following field. For example, if you define "sta" as the trigger value in the following field and your device receives a context payload with the value "status", then the event will be triggered.

  • Is not: The event will be triggered if the key’s value is anything but the text defined in the following field.

4. Enter the key value that will dictate the triggering of the event.

Note: This field is case sensitive, so make sure you enter the exact value that is sent to your variable’s context. This is true even when the condition is set to “contains”.

5. Finally, define after how long the event will activate if the previously configured conditions continue to be true.

If you leave this option at the default “0”, then, as soon as your device receives a context payload that matches your trigger configuration, the event will be activated. If, for example, you choose 5 minutes here, then the event will only activate if the last context payload received still matches your conditions; on the other hand, if the device receives a context payload with a different key value to the one defined after 4 minutes, the event won’t be activated.

Based on the previous idea, it makes sense to define this time according to the rate at which the variable is updated.

1.2. Actions

After finishing all the steps in the “triggers” tab and clicking on “next”, you’ll move onto the “actions” tab. There, you’ll be able to select and configure the action that will be triggered when the event is activated.

  1. Click on the “+ add action” button to start this process. These are the options you can choose from:

For a detailed explanation on how each of the actions work and how to configure them, visit their respective article (linked above).

1.3. Settings

After completing the action configuration and clicking on “next”, you’ll proceed to the final step, the “settings” tab. There, you’ll identify your event and define its active windows.

  1. Start this stage by naming your event and, optionally, giving it a description so that it’s easy to distinguish from other events later on.

  2. Another optional step is to use a tag on the event. This is a great tool to control what your end users see in your app. In this case, for instance, you could decide that your end user sees one event, but not another, using tags. Learn more about tags here.

  3. Determine the activity window in which the events should be executed. An event can have multiple active windows by clicking on the “+ add window button” and configuring them correspondingly. To learn more about how and when an event is activated, head to this guide.

Did this answer your question?