# Create 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.

> For the complete documentation index, see [llms.txt](https://docs.talon.one/llms.txt).

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

## Prerequisites

- You have a MoEngage account.
- You are an admin user in Talon.One and MoEngage.

## Set up the integration

<StepsContainer>

### Create a webhook

Let's create a [webhook](/docs/product/account/dev-tools/manage-webhooks.md) to MoEngage:

1. In the Campaign Manager, click <Account className="icon"/> **Account** > <Tools className="icon"/>
   **Tools** > **Webhooks** and click **Create Webhook**.
1. Enter a name and select the Applications in which the webhook should be available.
1. Add the parameters to include in the request. In this tutorial, we'll use the following parameters:

    
    | **Param type** | **Param name** |
    | -------------- | -------------- |
    | `string`       | `profileid`    |
    | `string`       | `couponcode`   |
    

1. In **Request**, set **Verb** to **POST**.
1. In **URL**, enter `https://api-0X.moengage.com/v1/event/<WORKSPACE_ID>`, where `0X`
   is the MoEngage [data center number](https://developers.moengage.com/hc/en-us/articles/4413174104852-Create-Event), and `WORKSPACE_ID` is the MoEngage Workspace ID.
1. In **Headers**, click **Add** and define the following HTTP headers:
   - `Authorization: Basic <HEADER>`, where `<HEADER>` is a [Base64-encoded string](https://developers.moengage.com/hc/en-us/articles/4413174104852-Create-Event)
      containing the API username and password.
   - `Content-Type: application/json`
1. In **Payload**, add the request payload. In this tutorial, we'll use the following payload:

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

   :::tip
   To learn more about accessing Talon.One attributes and including them in the webhook,
   see [Use parameters in the webhook payload](/docs/product/account/dev-tools/manage-webhooks.md#use-parameters-in-the-webhook-payload).
   :::

### Create the rule

Let's [create a standard campaign](/docs/product/campaigns/create-and-manage-campaigns.md)
with a single [rule](/docs/product/rules/overview.md). 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`.
1. **Send MoEngage Email**: **profileId** is `Integration ID(Customer Profile)` and **couponCode** is `Generated coupon in Session`.

### Use the generated coupon code in MoEngage

You can now use the coupon code generated by Talon.One in your MoEngage campaign content.

To learn to create event-triggered campaign content,
see [Campaigns and channels](https://help.moengage.com/hc/en-us/categories/360002707651-Campaigns-and-channels).

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

</StepsContainer>

## Related pages

- [Display webhook logs](/docs/product/account/logs/webhook-logs.md)
- [Coupons and budgets](/docs/dev/tutorials/coupons.md)
