Webhook

Unlike traditional methods where one system constantly polls another system for information, Webhooks ensures that data is sent automatically when an event occurs.

How to setup Webhooks on the Roam Dashboard?

  • First, login to the Roam dashboard -> Select a project or create one and add apps to it.

  • Add geofences for that project from the Roam geofence page accessible via the top navigation tabs. Enable the geofence status for triggering events whenever the user using your app enters or exits the geofence.

  • Go to the settings tab on the dashboard. Under the Webhooks section, you will see options for Webhooks and Slack integration. There is a provision to enable either Webhooks or Slack integration to subscribe to the user events from the server-side. You can also test these events by selecting an event to test at the given endpoint.

  • You can now enable this feature by entering the respective URLs. Remember to configure the same URL at your end to receive Webhook or Slack notifications.

NOTE: These are the URLs you create from your Slack and put in the Roam dashboard.

  • After integration, you can monitor the user locations, geofence and trip events.

Each POST request will consist of any one of the three objects.

  1. Event - To notify geofence entry and exit events.

  2. User - To notify user movement updates with respect to user activity. ie. Stop “S”, Moving “M”.

  3. Trip - To notify trip start and end.

You can also receive real-time location events client-side via the SDK with didUpdateLocation() which has less latency.

Sample Webhook URL for notifications:

https://www.example.com/< YOUR-WEBHOOK-ENDPOINT >

Response as input:

  {
  "event":  [
    {
      "user_id": "60b08d4f51efb00609f9afb1",
      "location_id": "60b08d5f1b9e3900007afb07",
      "geofence_id": "60af36958ce7db2395eb7a87",
      "recorded_at": "2021-05-28T06:27:43.080Z",
      "event_source": "geospark:geofence",
      "event_version": "1.0",
      "event_type": "geospark:geofence:Exit",
      "location": {
        "type": "Point",
        "coordinates": [
          85.06905784228388,
          25.605483727570086
        ]
      },
      "speed": 0,
      "course": 83.14997873855464,
      "altitude": 56.562080901085935,
      "activity": "M",
      "vertical_accuracy": null,
      "horizontal_accuracy": 88.64567615715366
    }
  ]
},
   {
  "coordinates":
   {
    "type": "Point",
    "coordinates": [
      85.06905784228388,
      25.605483727570086
    ]
  },
  "location_id": "60b08d5f1b9e3900007afb07",
  "recorded_at": "2021-05-28T06:27:43.080Z",
  "user_id": "60b08d4f51efb00609f9afb1",
  "event_version": "1.0",
  "event_source": "geospark:location",
  "event_type": "geospark:location:point",
  "speed": 0,
  "course": 83.14997873855464,
  "altitude": 56.562080901085935,
  "activity": "M",
  "vertical_accuracy": 71.87669804650587,
  "horizontal_accuracy": 88.64567615715366
},
 {
  "events": [
    {
      "user_id": "60b08d4f51efb00609f9afb1",
      "location_id": "60b08de376886500001e6827",
      "trip_id": "60b08da506f8a07362ca08bd",
      "trip_location_id": "60b08da506f8a07362ca08be",
      "recorded_at": "2021-05-28T06:29:55.729Z",
      "event_source": "geospark:trip",
      "event_version": "1.0",
      "event_type": "geospark:trip:reached_origin",
      "location": {
        "type": "Point",
        "coordinates": [
          85.0692907329729,
          25.605278502615263
        ]
      },
      "speed": 0,
      "course": -1,
      "altitude": 55.64597914647311,
      "activity": "S",
      "vertical_accuracy": null,
      "horizontal_accuracy": 5.027652817850262
    }
  ]
}

Last updated