> For the complete documentation index, see [llms.txt](https://docs.loyaltysurf.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.loyaltysurf.io/tutorials.md).

# Tutorials

Tutorials for common types of loyalty and reward programs

## Tutorial 1: How to set up a points-based loyalty program

Let's say you want to give rewards to your customers in the form of points. And if a customer earns 100 points, they can unlock a reward, which can be a custom coupon or discount.

LoyaltySurf supports [participant metadata](https://docs.loyaltysurf.io/integrations/rest-api/api-guidelines#metadata), which makes this loyalty program possible to implement.

Let's imagine you will give your users 10 points each time they do something, and that it will take 100 points to unlock a reward.

### How to set up this loyalty program:

1. Create your first LoyaltySurf program and at the first step in the program editor, create a new reward. In the advanced reward settings, make sure the loyalty actions required is 1 (this is the default).
2. Next, we need to add your users into your LoyaltySurf program:
   1. For your existing users, you'll need to import them by clicking *Add > Import Participants* from your [admin dashboard](https://app.loyaltysurf.io/dashboard)*.*
   2. For new users, you'll need to call [`/POST Add participant`](https://docs.loyaltysurf.io/integrations/rest-api/api-reference#add-participant) every time someone new signs up
3. Whenever your user performs an action, call [`/POST Update participant`](https://docs.loyaltysurf.io/http:/update%20participant%20by%20email) to update their [metadata](https://docs.loyaltysurf.io/integrations/rest-api/api-guidelines#metadata) value. For example:`Participant.metadata.points = Participant.metadata.points + 10`.
   1. On the API response, check if `(Participant.metadata.points > 100)` then call [`/POST trigger loyalty action by email`](https://docs.loyaltysurf.io/integrations/rest-api/api-reference#loyalty-actions), which will unlock the reward for the participant.
4. Then after the reward is unlocked, implement the following:
   1. Set up [webhooks](https://docs.loyaltysurf.io/integrations/webhooks) to automate reward fulfillment (so that the user gets their reward).
   2. Call [`/POST Update participant`](https://docs.loyaltysurf.io/http:/update%20participant%20by%20email) and decrement  `Participant.metadata.points` by 100 to make sure the participant's points are reset.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.loyaltysurf.io/tutorials.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
