For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom Events

Rewarding what members do outside a purchase — reading content, entering codes, registering devices, opting in — with custom events, safely and only once.

A custom event is anything a member does that isn't a purchase: reading an article, answering a survey, entering a code from a pack, registering a device, subscribing to a newsletter, connecting a social account. Your systems send the event; campaigns and challenges in Open Loyalty decide what it's worth.

For purchases and returns, use transactions. For the Admin Panel side, see Custom events, Custom event schemas and the custom event campaign trigger.

Who does what

Area
Responsibility

Admin Panel

One schema per event type with the attributes rules need; custom event campaigns, challenges and, for codes, redemption code campaigns

Integration layer

Sends one event per member action with a deterministic eventId; treats a duplicate as already processed

Website / app

Reports the action; validates codes in real time if your system owns them

CRM / marketing automation

Receives campaign effects and balance changes through webhooks

Design decisions

Decision
Options
Recommendation

Event types

One generic type with a kind attribute, or one type per action

One type per action (article_read, device_registration, newsletter_opt_in). Campaigns, challenges and reports stay readable.

Attributes

Only an ID, or everything a rule might use

Send what rules filter on (category, brand, product, channel). An attribute that isn't in the event can't be used later.

eventId

Random, or derived from the action

Derived, so the same action always has the same ID — see below.

Who validates codes

Your system, or an Open Loyalty redemption code campaign

Your system if codes already live there or the member must see "used" or "invalid" immediately. Open Loyalty if you want it to generate or hold the code pool.

One reward per action, or limits

Per event, or capped per member and period

Use campaign limits for caps (e.g. one reward per article, five codes per month).

1

Configure (Admin Panel)

Create a schema for each event type. Add custom event campaigns or challenges that react to the type and its attributes, with limits for anything that can be repeated.

2

Send the event

POST /api/{storeCode}/customEvent with type, eventDate, the member identifier in customerData (e.g. loyaltyCardNumber), the attributes in body, and an eventId.

3

Make it idempotent

eventId is optional in the API but unique per tenant when sent. Build it from the action itself, so a retry or a repeated click produces the same ID:

Action

eventId

Article read

{customer ID}_ARTICLE_{article key}

Newsletter opt-in

{customer ID}_NEWSLETTER_{list}

Device registration

DEVREG_{device serial}

Code entry

the code, or your system's scan ID

A second event with the same eventId is rejected with 400 "Custom Event with such event id already exists" — treat it as already processed, not as a failure.

4

Handle codes

If your system owns the codes, validate them in real time, mark them used, and send events only for valid codes (with the code as eventId). If Open Loyalty owns them, send the entered code in the schema's code attribute and let a redemption code campaign check it against its pool.

5

Tell the member

Subscribe to CampaignEffectWasApplied and WalletBalanceUpdated to message the member or update CRM. If an event awards a fortune wheel spin instead of points, it still has to be drawn — see fortune wheels.

Sequence diagrams

The website or app reports a completed member action. The integration layer builds a deterministic eventId and sends a custom event with type, eventId, event date, loyalty card number and body. Open Loyalty matches the member and runs custom event campaigns and challenges, returns the customEventId and sends CampaignEffectWasApplied and WalletBalanceUpdated webhooks, passed on to CRM. Sending the same eventId again returns 400 because it was already processed.
Member action
A member enters or scans a code. Either the integration layer validates the code in your system, shows valid, used or invalid at once, and sends a custom event only for valid codes with the code as eventId; or it sends the entered code to Open Loyalty, where a redemption code campaign checks it against its pool, marks it used and awards the member.
Code entry: validated in your system or in Open Loyalty

Go-live checklist

Admin Panel

Integration layer

Website / app

Validation

Key endpoints

Webhooks: CampaignEffectWasApplied, WalletBalanceUpdated

Last updated

Was this helpful?