Skip to content

Geo Recipes

NearIT allows you to integrate geografic rules both as Trigger and Who:

  • Trigger: deliver a recipe when user enters or leaves a place
  • Who: target users that have been in a place

Geo Triggers

You can deliver recipes when a user enters o leaves a place by working on the pulse plugin of a recipe.
You will need to specify the desired user action and an id or tag of a place.

Quick example: notification on geofence enter

This example shows how to send a notification when a user enters a geofence.
This event is described by the enter_place action of our geopolis plugin. You will need to provide the id of the place of interest as pulse_bundle_id.
We strongly suggest to also setup a cooldown interval, it will avoid your users to be spammed (i.e. 86400 sec).

POST https://api.nearit.com/recipes

{
  "data": {
    "type": "recipes",
    "attributes": {
      "owner_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "app_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "name": "geo notification",
      "state_event": "finalize",
      "notification_translations": {
        "en": {
          "body": "Hello World"
        },
        "it": {
          "body": "Ciao Mondo"
        }
      },
      "default_language": "en",
      "operation_plugin_id": "congrego",
      "operation_action_id": "evaluate_segment",
      "operation_bundle": {
          "owner_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
          "app_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
      },
      "reaction_plugin_id": "simple-notification",
      "reaction_action_id": "simple_notification",
      "reaction_bundle_id": null,
      "pulse_plugin_id": "geopolis",
      "pulse_action_id": "enter_place",
      "pulse_bundle_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "cooldown":{  
        "self_cooldown": 86400
      }
    }
  }
}

Available Triggers

NearIT includes many different triggers:

Trigger Plugin Action Required bundle
User enters in a geofence geopolis enter_place place
User leaves a geofence geopolis leave_place place
User enters in a beacon area geopolis enter_area area
User leaves a beacon area geopolis leave_area area
User lays his device on a beacon (with the app opened) geopolis ranging.immediate beacon
User goes near a beacon (with the app opened) geopolis ranging.near beacon
User enters in a tagged area geopolis enter_tags tag combination
User leaves in a tagged area geopolis leave_tags tag combination
User lays his device on a tagged beacon (with the app opened) geopolis ranging_tags.immediate tag combination
User goes near a tagged beacon (with the app opened) geopolis ranging_tags.near tag combination

Complete Reference

For more details about our location system please look at the NearIT Geopolis APIs reference.