Webhook
  • First login to Cyprinus dashboard, select a project or create one and add apps in it.
  • Add geofences for that project from the Cyprinus geofence page accessible via 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 in the dashboard, where you will see options for webhook and slack integration. This again has an option that lets you choose which one you want to enable and actively use for the subscription.
  • Now you can enable this feature by entering the respective URLs and please configure the same URL at your end for getting in your webhook or slack notifications.
  • NOTE: These are the URLs you create from your slack and put them in the Cyprinus dashboard.
  • After integration, you can monitor the users and geofence 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!

****

Sample slack URL for notifications:

Slack can be added in a similar fashion as we are integrating webhooks.
1
https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Copied!

Message format:

1
Event Triggered:
2
Type: entry
3
User ID: 5bdad5f7eec1a507afa2fece
4
User Description: John Doe
5
Geofence ID: 5bc89a4feec1a44e738db309
6
Geofence Description: John Office
7
Recorded At: 2018-11-23T10:27:32.000
8
Event ID: 5bed5a6e878b1b00012xaec5
Copied!
Last modified 4mo ago