Geofencing is a powerful feature that uses GPS to define geographical boundaries. With Ubidots, you can create an event that triggers when a device enters or exits that area.
1. Creating an event with a geofence trigger
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 geofence alert.
1. Click on the “+ add trigger” or “+ add OR group” buttons and select “geofence”. 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 the "Position Accuracy" variable. Multiple variables can be added using AND (“+ add trigger”)/OR (“+ add OR group”) conditionals.
3. Click on the “set geofence” button to create the geofence. You can select whether to draw a circle or a polygon from the upper right corner of the geofence modal, and then draw your geofence on the map.
Polygon:
Circle:
4. Define whether the event will be activated when the device enters or exits the geofence by selecting the desired option in the “trigger on” dropdown.
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 the device enters or exits the geofence the event will be activated. If, for example, you choose 30 minutes here, then the event will only activate if the device is inside/outside the geofence after that time has elapsed; on the other hand, if the device returns to its normal position after 29 minutes the event won’t be activated.
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.
Click on the “+ add action” button to start this process. These are the options you can choose from:
Send SMS
Make voice call
Send Slack
Notify user
Set variable
Trigger webhook
Trigger function
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.
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.
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.


