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. 1.
    Event - To notify geofence entry and exit events.
  2. 2.
    User - To notify user movement updates with respect to user activity. ie. Stop “S”, Moving “M”.
  3. 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:

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

Response as input:

1
{
2
"event": [
3
{
4
"user_id": "60b08d4f51efb00609f9afb1",
5
"location_id": "60b08d5f1b9e3900007afb07",
6
"geofence_id": "60af36958ce7db2395eb7a87",
7
"recorded_at": "2021-05-28T06:27:43.080Z",
8
"event_source": "geospark:geofence",
9
"event_version": "1.0",
10
"event_type": "geospark:geofence:Exit",
11
"location": {
12
"type": "Point",
13
"coordinates": [
14
85.06905784228388,
15
25.605483727570086
16
]
17
},
18
"speed": 0,
19
"course": 83.14997873855464,
20
"altitude": 56.562080901085935,
21
"activity": "M",
22
"vertical_accuracy": null,
23
"horizontal_accuracy": 88.64567615715366
24
}
25
]
26
},
27
{
28
"coordinates":
29
{
30
"type": "Point",
31
"coordinates": [
32
85.06905784228388,
33
25.605483727570086
34
]
35
},
36
"location_id": "60b08d5f1b9e3900007afb07",
37
"recorded_at": "2021-05-28T06:27:43.080Z",
38
"user_id": "60b08d4f51efb00609f9afb1",
39
"event_version": "1.0",
40
"event_source": "geospark:location",
41
"event_type": "geospark:location:point",
42
"speed": 0,
43
"course": 83.14997873855464,
44
"altitude": 56.562080901085935,
45
"activity": "M",
46
"vertical_accuracy": 71.87669804650587,
47
"horizontal_accuracy": 88.64567615715366
48
},
49
{
50
"events": [
51
{
52
"user_id": "60b08d4f51efb00609f9afb1",
53
"location_id": "60b08de376886500001e6827",
54
"trip_id": "60b08da506f8a07362ca08bd",
55
"trip_location_id": "60b08da506f8a07362ca08be",
56
"recorded_at": "2021-05-28T06:29:55.729Z",
57
"event_source": "geospark:trip",
58
"event_version": "1.0",
59
"event_type": "geospark:trip:reached_origin",
60
"location": {
61
"type": "Point",
62
"coordinates": [
63
85.0692907329729,
64
25.605278502615263
65
]
66
},
67
"speed": 0,
68
"course": -1,
69
"altitude": 55.64597914647311,
70
"activity": "S",
71
"vertical_accuracy": null,
72
"horizontal_accuracy": 5.027652817850262
73
}
74
]
75
}
Copied!