# Custom Event

A Custom Event trigger activates when your external system sends a predefined event to Open Loyalty via API. You must first create a **Custom Event Schema**, which defines event names and optional attributes. Once the schema is in place, you can launch a **separate campaign** that responds to those custom events—fully independent from other campaign types.

***

### 🛠️ Step-by-Step Setup

{% stepper %}
{% step %}
**Create Custom Event Schema**

* Navigate to **Custom Events → Custom Event Schemas**
* Add optional  attribute (e.g., `steps`) that can be used later on in the campaign rules.
* Save the schema status to **Active**

{% hint style="info" %}
For more information on how to create a custom event schema, please refer to this section of the User Guide: [Custom Event Schemas](/main-features/custom-events/custom-event-schemas.md)
{% endhint %}
{% endstep %}

{% step %}
**Add Campaign**

* Go to **Campaigns** or **Referral Campaigns** → ***Add campaign*** → select **Custom Event** trigger.
* Choose your event name from the schema dropdown. Attributes defined in the schema become available for use in rule conditions.&#x20;
  {% endstep %}

{% step %}
**Set Basic Campaign Details**

* Name, Description, Translations
* Start/End Date, Display Order, Visibility (Everyone / Segment / Tier)
* **Campaign Status** – The campaign will start only if it is active
  {% endstep %}

{% step %}
**Add Rules**

* Add **Conditions** using `event.body.<attribute>` (e.g., filtering where `event.body.steps ≥ 5000`)&#x20;
* **Effect**: e.g., "Add units: 1 × amount of steps", "Add 100 fixed points", "Issue coupon".
  {% endstep %}

{% step %}
**Set Limits & Budget**

* Per-member frequency (e.g., once per month)
* Campaign-level spending caps (total units)
  {% endstep %}

{% step %}
**Summary**

* Review the campaign configuration and amend if needed
* Click on **Add Campaign**
  {% endstep %}

{% step %}
**Test Campaign - Send Event via API**

Use `POST /api/{storeCode}/customEvent` with payload:

```json
{
  "event": {
    "type":"app_login",
    "eventDate":"2025-07-15T11:26:46.299Z",
    "customerData": { "email":"email@example.com" },
    "body": { "key":"value" }
  }
}
```

Successful sends return status 200.&#x20;
{% endstep %}
{% endstepper %}

***

### ⚙️ Why Use Custom Event Campaigns

* **Flexibility**: Trigger campaigns on any behavior tracked externally—app usage, fitness milestones, third‑party integrations, and more.&#x20;
* **Precision Targeting**: Use schema attributes in conditions to segment and personalize campaigns.
* **De-coupled Execution**: Events and campaigns are independent—no side effects on other systems.

***

### ✅ Best Practices

* **Define Schemas Thoughtfully**: Include only necessary attributes needed for campaign logic.
* **Test End-to-End**: Send test events via API and verify they appear under **Custom Events** in the admin UI.
* **Limit Rewards**: Use per-member and campaign-wide limits to prevent over-issuing.
* **Track Engagement**: Monitor event-driven campaign metrics to understand response rates.


---

# 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/main-features/campaigns/campaigns-and-referral-campaigns/creating-campaigns/trigger-types/custom-event.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.
