Skip to main content

Creating a webhook to CleverTap

You can integrate Talon.One with CleverTap using a webhook.

With this integration, you can configure both platforms in such a way that coupon codes generated in Talon.One are sent to specific customer segments in CleverTap.

In this tutorial, let's set up our Talon.One campaign in such a way that it generates a coupon code on New Year's Day (1 January) and our CleverTap campaign sends it to a target segment in an email message.

CleverTap integration method

To integrate with CleverTap, let's do the following:

  1. In Talon.One, create a standard campaign to generate a coupon code and send it to CleverTap.
  2. In CleverTap, embed the received coupon code in an email message and send it to a target segment.

To send the generated coupon code from Talon.One, we send a request to the Upload Events API endpoint, with the generated coupon code in the request payload. To make this request, we configure a webhook to CleverTap.

To track this coupon code transmission in CleverTap, we use a custom event with an event property.

Prerequisites

  • You have a CleverTap account.
  • You are an Admin user in Talon.One and CleverTap.
  • You have configured an email provider in CleverTap and tested it.
  • You have created a custom event with an event property in CleverTap to track the Talon.One coupon code. In this tutorial, we assume this custom event is called Coupon Generated and the event property is called CouponCode.

Creating a webhook

In Talon.One, let's create a webhook to CleverTap and name it Send CleverTap Email.

Adding parameters

Add parameters for any webhook-specific data to pass to CleverTap. In our case, we want to pass the profile ID of the user and the generated coupon code, so we create the following parameters:

Param typeParam name
stringProfileID
stringCouponCode
tip

Use a universal ID as ProfileID to identify the user in Talon.One and CleverTap.

Creating the request

CleverTap provides a list of the required HTTP headers for the Upload Events API endpoint. Using the list as a point of reference, we create the following request:

  1. Set Request Verb to POST.
  2. Target the relevant URL based on the Region of your CleverTap account:
    • https://<CleverTap API endpoint>/1/upload
  3. Define the HTTP headers based on the CleverTap Upload Events API requirements:
    • X-CleverTap-Account-Id: <CleverTap Project ID>
    • X-CleverTap-Passcode: <CleverTap Project passcode>
    • Content-Type: application/json; charset=utf-8
tip

To view the details of your CleverTap project, in CleverTap, click Settings > Project.

Creating the payload

CleverTap provides an example of the request payload for the Upload Events API endpoint. The values of the parameters identity and CouponCode are dynamically replaced by the values from our Talon.One campaign. Here, the evtData (event data) parameter CouponCode represents the event property we created as a prerequisite in CleverTap.

{
"d": [
{
"type": "event",
"evtName": "Coupon Generated",
"$source": "Talon.One",
"identity": "${$ProfileID}",
"evtData": {
"CouponCode": "${$CouponCode}"
}
}
]
}
note

Your payload definition may vary depending on the event data that you dynamically populate in your CleverTap campaign content, but the same principles apply.

To learn more about accessing Talon.One attributes and including them in the webhook, see Using parameters in a webhook.

Creating a campaign in Talon.One

Let's create a campaign with a single rule.

Name the rule Create coupon on 1 January and add one condition and two effects:

Condition

  • Check attribute value: Current time is on exact day 01/01/2023.

Effects

  1. Create coupon code: In the current campaign, Recipient is Current Customer (Friend), and Redemption Limit is 100.
  2. Send CleverTap Email: ProfileID is Integration ID(Customer Profile) and CouponCode is Generated coupon in Session.

Creating a campaign in CleverTap

CleverTap allows you to send a message using channels such as email, SMS, and push notification. In this example, we use email.

note

In this tutorial, we ignore the optional settings offered by CleverTap. To learn about creating campaigns using the email channel, in the CleverTap documentation, under Email, see Create message.

To create a campaign in CleverTap:

  1. On the sidebar, click Messages > Campaigns and + Campaign > Email.
  2. In Name, type a name for your campaign.
  3. In Start here > Qualification criteria, select Live behavior and click Done.
  4. In Email Service Provider, select the email provider you configured as a prerequisite and click Done.
  5. In Who > Target Segment > Find user from segment, select Single action: New segment.
  6. In As soon as the user does, select the name of the event you created (Coupon Generated, in our case) and click Done.
  7. In What, select Single Message and click Go To Editor.
  8. Select a template and personalize your message in the message editor.
  9. To embed the Talon.One-generated coupon code, in the email body, type @ and select the event property you created (@Coupon Generated - CouponCode, in our case).
  10. To show a default value if the coupon code is not available, in default:, type a value and click Done.
  11. In Sender details, enter the details of the sender information you want to show and click Done.
  12. In When > Date and time, select Now and click Done.
  13. To publish the campaign, click Publish Campaign.

On 1 January, the customer segments defined in CleverTap receive an email with the coupon code generated by Talon.One.