Integration using Clevertap
This document serves as a guideline for developers on the Publisher backend, facilitating the integration of Zendrive webhook with Clevertap.
Prerequisites:
Publishers have accounts in Clevertap which gives them the access to the required keys.
API calls made to Clevertap contain an ‘identity’ field in the payload which helps to uniquely identify a user. Value of this field can be the user's email_id or user_id.
The user information like email and device information is added in Clevertap, ensuring that the email and push notifications are being sent.
Publishers have email or push notification templates in Clevertap for all the different types of webhooks sent by Zendrive.
Publishers associate the templates to a journey, causing notifications to be triggered whenever a corresponding webhook is activated.
Procedure:
Log in to Clevertap.
To configure webhook, you must add user and event data. To add user and event data, you can choose one of the following methods. a. SDK integration with CleverTap. b. Use the upload-user-profile API to upload user’s data from your backend server.
Sample Python Code:
import requests
headers = {
'X-CleverTap-Account-Id': '4x6-RR9-896Z',
'X-CleverTap-Passcode': 'Aqq-ISV-ZXUL',
'Content-Type': 'application/json; charset=utf-8',
}
data = '{"d":[{"identity":"[email protected]","type":"profile","profileData":{"Name": "Test User,"Email":"[email protected]","Phone":"+91xxxxxxxxxx"}}]}'
response = requests.post('https://api.clevertap.com/1/upload', headers=headers, data=data)
To upload events from your backend server, use the upload-events API.
Sample Python Code:
import requests
headers = {
'X-CleverTap-Account-Id': '4R6-RR9-896Z',
'X-CleverTap-Passcode': 'AqC-ISV-ZXUL',
'Content-Type': 'application/json; charset=utf-8',
}
data = '{ "d": [ { "identity":[email protected], "ts": 1699007800, "type": "event", "evtName": “Webhook fired”,"evtData": { "type": “webhook fired”, "subtype": “first trip”, "trip_count": 1} } ] }'
response = requests.post('https://api.clevertap.com/1/upload', headers=headers, data=data)
To set up email service in your account, see Email setup.
To set up push notifications in your account, see Push-notifications-ios or Android-in-app-notifications.
Create campaigns for email and push notifications.
Create a journey to define how users receive communication once a specific event is triggered for them. For more information, see Journeys.