CleverTap webhooks enable developers to monitor specific user events and receive push notifications to their server when those events happen.

Overview

CleverTap webhooks are often used to trigger business workflows. For example, let’s say you want to get notified every time a user looks up an international flight in business class, but then doesn’t book the flight within 30 minutes. You can set up a webhook in CleverTap to monitor for this specific event, get notified when it happens, and then trigger a process in your call center to contact the user to complete the booking.

Another popular use case for CleverTap webhooks is with ecommerce companies and cart abandonment. Let’s say a user abandons their cart during a high-value transaction. You can set up a webhook in CleverTap to monitor for this specific event, get notified when it happens, and then trigger a call center workflow to contact the user to solve any issues and complete the purchase.

There are six categories of webhooks that you can create to monitor user events. The table below describes each of those categories.

Type
Description
Example

Single action

User performed an action.

User launched the app.

Actions

User performed multiple actions.

User launched the app and viewed a notification.

Inaction within time

User performed an action, but does not perform another action within a certain time.

User has not launched the app in three days.

Inaction

Users performed an action, but did not perform another action.

User launched the app, but did not view a notification.

Date time property

Period of time after a date time property on a user event.

User purchased an item and three days have passed.

Actions with user properties

Performed an action or not, filtered by their demographic properties.

User purchased an item and lives in Canada.

Webhooks are created in the CleverTap dashboard by defining a user segment and a callback URL on your server. CleverTap will send a webhook as a HTTP POST with information about the event when it occurs. You can customize the webhooks to use basic authentication and include any custom properties if needed.

Paid Feature

Please note this is feature is only available to paid accounts. To enable webhooks, please upgrade your account to a paid plan.

The rest of this page walks through how to create your first CleverTap webhook.

Step 1: Set Up Webhook in CleverTap Dashboard

Go to the Messages page of the CleverTap dashboard. Click on the + Message button.

Click on the Webhooks button.

If you have an existing segment that you want use for the webook, select that segment. Otherwise, click the + Create ad-hoc segment button.

In the Single action box, click + Create segment

Choose a name for the webhook. Click Continue to When.

On the When page, you keep the default settings and click Continue to Who. If you want to choose a different start date, end date, or add a delay for the webhook, you can modify it on this page.

Under As Soon as User Does, select App Launched. Click Continue to What.

Click Add a new webhook URL, which is where CleverTap will send the webhook.

Click + Add new

Add a Webhook name and Destination URL. If you currently don’t have an endpoint created on your server to receive the webhook, you can use Requestb.in to create an endpoint for testing purposes. Click Save.

Under Webhook URL, select the one you just created. You have the option to receive email, identity, objectId (CleverTap ID), profileData (custom profile variables), and push_token for each user.

Click Continue to Overview and then Click Deploy Webhook.

Step 2: Listen for Webhooks on Your Server

In the previous step, we created a webhook to send notifications to our server when a user launches our app.

If you have CleverTap already integrated in your app, try launching your app now. Then go back to the Messages page in the dashboard. You will see a webhook was sent to your server.

Below is a sample webhook payload containing all possible fields. targetId corresponds to the webhook campaign ID for which you are receiving the payload.

{
    "targetId": 1472124953,
    "key_values": {
        "PromoCode": "MT50",
        "PowerUser": "true"
    },
    "profiles": [
        {
            "email": "jack@gmail.com",
            "identity": "foo",
            "objectId": "-g55b74fb1030740e4a4931910a8abb862",
            "profileData": {
                "Last Score": 308,
                "High Score": 308,
                "Replayed": true
            },
            "event_properties": {
                "Score": 1200,
                "Game Mode": "Practice",
                "Rating": 1
            },
            "push_token": "19403aa5d3bb376769a8101c9cbf22159cb1836117659cc684a71243589982ea"
        },
        {
            "email": "jill@gmail.com",
            "identity": "bar",
            "objectId": "__g09c9bf3b0d374a259c86f5b855ec9b19",
            "profileData": {
                "Last Score": 309,
                "High Score": 309,
                "Replayed": true
            },
            "event_properties": {
                "Score": 500,
                "Game Mode": "Tournament",
                "Rating": 2
            },
            "push_token": "fiCjRO_opjw:APA91bH0yzS_eBj1Xx8TcakMzz4yTc3id29A79GOjnaaMtIQLrjztNfzzRz7slqWmNzndECx_hHh7qiL0LZJOkGwzr9Zp_g1mC9B6BVuEbsjrMFoxXX830zMRuvxtU_AhFTC0JPHejZh"
        }
    ]
}

Next Steps

Congrats on creating your first CleverTap webhook!

Another option besides setting up an endpoint on your server to listen for CleverTap webhooks is using a workflow automation tool, such as Tray.io or Zapier. These tools can help integrate a CleverTap webhook without any code and then send these notifications to other systems like Slack. If you are interested in learning more, we have a guide that walks through sending a CleverTap webhook to Slack via Tray.io.