Skip to main content

Creating a webhook to MoEngage

To make the most of Talon.One and MoEngage, you can integrate them by creating a webhook to MoEngage in Talon.One.

In this tutorial, let's create a webhook to MoEngage and create a campaign to send coupon codes on Christmas Day (25 December).

Prerequisites

  • You have a MoEngage account.
  • You are an Admin user in Talon.One and MoEngage.

Creating a webhook

Let's create a webhook to MoEngage and name it Send MoEngage Email.

Adding parameters

Add parameters for any webhook-specific data to pass to MoEngage. 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

Creating the request

  1. Set Request Verb to POST.
  2. Target the relevant URL. For MoEngage, it is: https://api-0X.moengage.com/v1/event/<APP ID>, where 0X represents the MoEngage data center number, and APP ID represents the MoEngage APP ID.
note
  • To learn about the data center number and APP ID, in the MoEngage documentation, see API Overview.
  • To learn about events, in the MoEngage documentation, see Event.

Setting the headers

Add the following mandatory HTTP request headers:

  1. Authorization: Basic <header>, where <header> represents a Base64-encoded string containing the DATA API ID as username and DATA API KEY as password for all API requests.
  2. Content-Type: application/json
  3. MOE-APPKEY: <APP ID>, where APP ID represents the MoEngage APP ID
note

Creating the payload

Let's define the payload of the request using the following parameters:

{
"type": "event",
"customer_id": "${$profileid}",
"actions": [
{
"action": "Coupon code creation",
"attributes": {
"CouponCode": "${$couponcode}"
}
}
]
}
note

Your payload definition may vary depending on the data you dynamically populate in your MoEngage 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 for coupon creation

Let's create a standard campaign with a single rule.

Name the rule Create coupon on Xmas Day and add one condition and two effects:

Condition

  • Check attribute value: Current time is on exact day 12/25/2022.

Effects

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

Using the generated coupon code in MoEngage

The webhook configuration is now complete. You can now use the coupon code generated by Talon.One in your MoEngage campaign content.

To learn to create event-triggered campaign content, in the MoEngage documentation, see Campaigns and channels.

tip

To verify whether MoEngage received a request, on the MoEngage dashboard, click Test & Debug > Recent events.