> For the complete documentation index, see [llms.txt](https://docs.hackle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackle.io/en/crm-marketing/webhook-guide/use-cases/coupon.md).

# Issue Discount Coupons via Webhook

{% hint style="info" %}
You can issue discount coupons based on cohorts.
{% endhint %}

## Discount Coupon Promotion Case Study

You can automate internal business logic using webhook campaigns.

Marketer Alice wants to run a **promotion that issues discount coupons to users who added items to their cart but did not make a purchase**.\
Every evening, she wants to find users who only left products in their cart, issue discount coupons, and boost the purchase rate.

Let's see how to use Hackle's webhook campaign in this case.

### Prerequisites

We assume that events for product detail page views, add to cart, and order completion, along with the user property for the number of items in the cart, are being collected.

Additionally, an API for issuing discount coupons must be prepared.

### Configure the Webhook

Follow the steps below to set up the discount coupon issuance promotion.

{% stepper %}
{% step %}
**Create a Cohort**

Click `Create Directly` in the `Cohort` tab to create a new cohort.

![](/files/xqUHAlrvRsD5VmGhRSNG)

Enter `Users who added to cart but did not purchase` as the name.

Select `user Id` as the User Identifier.

Then click `Start with Funnel`.

![](/files/l3IsTMERZnvq2Z6e7H3f)

Configure the period for the funnel condition.

Select `Specific Period` to match the discount coupon issuance promotion period.

Set the funnel conditions to users who completed **Product Detail Page View** → **Add to Cart Click** in that order, but did not trigger the **Order Complete** event.

Set the funnel type to `Closed Funnel`.

![](/files/UDurBIzvzZAwJkctQ2XI)
{% endstep %}

{% step %}
**Create a Webhook Campaign**

Click **`+ Create Campaign`** in the upper right corner of the **Webhook** menu in the Dashboard.

![](/files/wExRYddiqc8zVhwTzCPj)

Enter the desired campaign name to create it.

![](/files/JDjOvA5Kh5IBzmT82a6Z)
{% endstep %}

{% step %}
**Configure Request Information**

**Method Settings**

Enter the discount coupon issuance API address and set the Method to `POST`.

**Header Settings**

You can use [Liquid syntax](https://shopify.github.io/liquid/) to dynamically apply required API authentication information.

Here we used an example that applies the user's `access-token` to the `Authorization` Header.

![](/files/ZJPckXrvAyA5r2PoTm0M)

**Body Settings**

Write the Body so that the target user's `userId` is dynamically populated for coupon issuance.

![](/files/qmatorcYNJczCLR3LIHc)

**Request Body**

```json
{
  "identifiers": {
    "userId": "{{identifiers["$userId"] | default: "EMPTY_USER_ID"}}"
  }
}
```

{% endstep %}

{% step %}
**Target Settings**

Select the pre-created cohort in the target settings section.

You can add the cart remaining item count property as a filter condition.

This allows you to filter out users with no items left in their cart (e.g., after clearing the cart) so that webhooks are not sent to them.

![](/files/IhrAAqSwA7lLaQuQF8QH)
{% endstep %}

{% step %}
**Configure Recurring Send**

To issue discount coupons to targets every evening, set the send type to `Schedule-based`.

Set the recurrence cycle to `Every 1 day`.

Set the send period to the promotion period and the send time to the evening.

If needed, you can also configure fatigue management and duplicate send restrictions.

![](/files/KLk3EaFpJA6t0sSxW59i)
{% endstep %}

{% step %}
**Complete**

All settings for the discount coupon issuance promotion are complete.

Campaigns that leverage internal business logic like this can also be automated through Hackle's webhook campaigns.
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hackle.io/en/crm-marketing/webhook-guide/use-cases/coupon.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
