# Setting Up a Raffle

Raffles are a great way to engage customers by allowing them to redeem earned points for raffle tickets and win attractive prizes.

## Overview

In this example, we will set up a raffle scenario where customers:

* Earn points and redeem them for raffle tickets.
* Participate in a monthly raffle.
* Winners are randomly selected at the end of each month.

## Configuration Steps

{% stepper %}
{% step %}

### Create Tickets (Coupon Rewards)

Set up the reward representing a raffle ticket. The redeemed rewards will be used later as part of a lottery.

Below is a sample configuration provided in two formats: a detailed list and a JSON file that you can easily import into Open Loyalty.

{% tabs %}
{% tab title="Configuration Description" %}
Set up the reward representing a raffle ticket:

* **Reward Type:** Coupon
* **Coupon Type:** Value Coupon
* **Coupon Value Settings:** Fixed Value (must be greater than 0, e.g., 1)
* **Price in Points:** Set based on the item value (e.g., 500, 1000, 1500, 5000)
* **Availability:** Specific period (e.g., Dec 1 – Jan 31)
* **Visibility in Catalogue:** Always visible or visible during a set period
* **Targeting:** Can be targeted to specific customer tiers if required
* **Limits:** No redemption limits
* **Coupon Source:** Autogenerated
  {% endtab %}

{% tab title="Import File" %}

{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### Create Gifts (Material Rewards)

Set up the reward representing the winning prizes. The redeemed rewards will be used later to track the actual winners of a lottery.

Below is a sample configuration provided in two formats: a detailed list and a JSON file that you can easily import into Open Loyalty.

{% tabs %}
{% tab title="Configuration Description" %}
Configure the actual reward item:

* **Reward Type:** Material (or Coupon if needed)
* **Reward price in points:** 0
* **Availability & Visibility:** Only on the raffle draw day
* **Redemption Limits:** Typically limited to one per customer, and a total limit based on available stock (e.g., total 3 items available)
  {% endtab %}

{% tab title="Import File" %}

{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

###

{% endstep %}
{% endstepper %}

**3. Custom Event Schema**

Define a custom event to handle raffle results:

* **Event System Identifier:** e.g., `january_raffle`
* **Event Name:** e.g., "January Raffle"
* **Attributes:**
  * **Attribute Name:** Won reward
  * **Attribute Type:** Text
  * **Attribute System Identifier:** won\_reward

**4. Set Up Campaign for Raffle Winners**

Establish a campaign to distribute prizes based on the custom event:

* **Campaign Type:** Direct
* **Campaign Trigger:** Custom Event (defined previously)
* **Visibility:** Typically hidden, used internally for raffle management
* **Rules:**
  * **Condition:** `event.body.won_reward` equals specific prize (e.g., headphones)
  * **Effect:** Distribute the defined reward (e.g., Headphones)

#### Considerations:

* The raffle logic (random winner selection) is executed externally and integrated via custom events.
* Mark used raffle tickets as expired or categorised them separately for clarity.

This setup can be replicated each month or adjusted for different items and raffle frequencies.


---

# Agent Instructions: 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:

```
GET https://help.openloyalty.io/sample-setups/setting-up-a-raffle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
