engagement Webhook
Zendrive provides the ability to specify a Webhook through which the application publisher can receive notifications to engage users. This is an opt-in program where the publisher specifies the types and configurations of the engagement webhooks they want.
IQL offers the following types of engagement webhooks:
On this page, we have detailed the API Request-Response contract to support the IQL engagement program, meant for the Publisher's use.
Webhook Authorization
Zendrive will send the same API Key which is used in all the IQL API endpoints for authorization. Application publishers can use this API Key to verify that the webhook is coming from Zendrive.
POST
URL: Publishers to set up after setting up at their end.
Headers
Authorization*
String
APIKEY <api_key>
Sample Response Payload
driver_id
The unique identifier of the user; for example, [email protected]
.
type
The type of webhook in use, for example, activity_based or milestone_based.
subtype
The subtype of the webhook, for example, permission_issue
.
webhook_event_id
The event identification of the webhook, for example, 0cae1949-d852-4f97-8a38-eb6db2efcf55
.
request_id
The webhook request identifier. For example, 988d7058-fff7-470a-9b0f-63b1cb1e7556
.
metadata.created_at_timestamp
The webhook creation timestamp, in milliseconds. For example, 1654506334000
.
metadata.trips_count
The total number of trips taken by the user.
metadata.distance_miles
The total distance traveled by the user (in miles).
metadata.unique_driving_days
The number of days during which the user has taken trips.
metadata.opt_in_days
The number of days for which the user remains in the program.
metadata.date_last_drive
The date of the user's last trip, for example, 2022-04-02. This value will be set to null if the user hasn’t taken any trips yet.
metadata.zendrive_score
The Zendrive score assigned to the user.
metadata.progress_percentage
The percentage of completion of the user within the IQL program.
metadata.permission_status
The users permission status, considered only for the last 24 hours, based on the following values: 1. enabled: This value indicates that the latest permission status received in the last 24 hours is healthy.
2. disabled: This value indicates that the latest permission status received in the last 24 hours has some issues.
3. unknown: No permission status received in the last 24 hours.
permission_error_details
Information related to permission errors in detail. At present, we support only the following errors:
location_permission: This error indicates that the user has not granted the 'Always' location authorization. The error value can be:
while_using
,allow_once
ordeny
permissions.location_service: This error indicates that location services are disabled on the user's device. The error value is 'off'.
activity_permission: This error indicates that the user has not granted the 'Always' activity authorization. The error value can be:
while_using
,allow_once
ordeny
. At present, this permission error is being considered only for Android users.
Note: The permission_error_details
field will be set to null if the permission_status
field is enabled or the value is unknown.
permission_timestamp
The timestamp of the latest permission packet in milliseconds, for example, 1654506334000
. This value will be set to null if permission_status
is unknown.
Sample Response Payload
{
"driver_id": "[email protected]",
"type": "activity_based",
"subtype": "permission_issue",
"webhook_event_id": "0cae1949-d852-4f97-8a38-eb6db2efcf55",
"request_id": "988d7058-fff7-470a-9b0f-63b1cb1e7556",
"metadata": {
"created_at_timestamp": 1654506334000,
"trips_count": 5,
"distance_miles": 80.502,
"unique_driving_days": 5,
"opt_in_days": 8,
"date_last_drive": "2022-04-02",
"zendrive_score": 90,
"progress_percentage": 90.52,
"permission_status": "disabled",
"permission_error_details": {
"location_permission": "while_using",
"activity_permission": "deny"
},
"permission_timestamp": 1654506334000
}
}