# Loyalty triggers and actions in CRM workflows

> Start CRM workflows when members join, earn stamps or unlock rewards, change stamps and redeem rewards from a workflow, and workflows to start with.

The **Leal Loyalty** app adds loyalty triggers and actions to your CRM's workflow builder. Triggers start a workflow from something that happened in your loyalty programme, such as a stamp from a till sale. Actions change the programme from a workflow, such as adding a birthday stamp.

They appear in the workflow builder of every client account that has the app. Your CRM charges for marketplace triggers and actions per run, as part of its premium workflow features, and they need those features switched on for the account. If you'd rather not pay per run, see [Without premium triggers and actions](#without-premium-triggers-and-actions).

## Triggers

| Trigger | Starts when | Filters |
| --- | --- | --- |
| Customer joined loyalty | Someone becomes a member (a poster, your till, the API or your CRM) | None |
| Card issued | A member gets a loyalty card | Card |
| Stamp earned | A member's card gets stamps | Card, Source |
| Reward unlocked | A member reaches enough stamps for a reward | Card, Reward |
| Reward redeemed | A member redeems a reward | Card, Reward |
| Referral rewarded | A friend a member invited has their first visit, so both get their referral stamps. Runs for the member who invited | Card |

**Source** tells you where a stamp came from: **Scan** (staff scanned the card), **Square**, **Shopify**, **Clover**, **Lightspeed** or **Epos Now** (a till sale), **Api** (the API, an automation or a workflow action), **Welcome** or **Referral**. Filter on it to thank customers for a visit only when the stamp came from the till, for example.

Every trigger runs for the member's contact, so the workflow can text, email or tag them. If the store has **Add Leal members to the CRM** turned off and the member isn't linked to a contact yet, the workflow runs without a contact.

Each trigger also passes values you can use in later steps, such as the member's stamps, the reward's name and the card link. Pick them from the trigger's values in the workflow builder.

## Actions

| Action | What it does | Values it returns |
| --- | --- | --- |
| Add stamps | Adds 1 to 50 stamps to the contact's card, with an optional note for the stamp history. Gives them a card first if they don't have one | New stamps, next reward, card link |
| Remove stamps | Takes away up to 50 stamps, never more than the card has | New stamps |
| Issue card | Gives the contact a card if they don't have one, and writes their loyalty fields straight away | Card link, Apple Wallet link, Google Wallet link, referral link |
| Redeem reward | Redeems a reward you choose, or **Next available reward** (the cheapest one they have enough stamps for) | Reward name, stamps left |
| Find member | Looks the contact up without changing anything | Whether they're a member, stamps, rewards available, card link |

Stamps changed by an action are recorded in the member's stamp history as **api**, with "CRM workflow" and your note. A contact needs an email address or phone number to become a member.

## Workflows to start with

### Welcome new members

Trigger **Card issued**, then a **Send SMS** step: "Here's your loyalty card for {{contact.loyalty_store}}: {{contact.loyalty_card_link}}". This is how card links reach new members when **Send card links from Leal too** is off.

### Send card links after an import

Trigger **Contact tag added** (your CRM's own trigger) with the tag `loyalty-send-card-link`, then a **Send SMS** or **Send email** step with `{{contact.loyalty_card_link}}`, then **Remove tag**. Set this up before you use **Send card links** on the Integrations page. See [Send card links](https://docs.getleal.com/integrations/crm#send-card-links).

### Reward unlocked

Trigger **Reward unlocked**, then a text: "You've earned {{contact.loyalty_next_reward}}! Show your card next time you're in."

### Review request after a reward

Trigger **Reward redeemed**, a **Wait** of 2 hours, then your review request.

### Birthday bonus

Your CRM's own birthday trigger, then the **Add stamps** action with a note such as "Birthday".

## Without premium triggers and actions

If an account can't use premium triggers and actions, you can still:

- use the loyalty fields in your CRM's built-in **Contact changed** trigger and in conditions (for example, **Loyalty Card Status** changed to **Added to wallet**), and
- change stamps from a workflow with your CRM's **Webhook** action calling the Leal API with an [API token](https://docs.getleal.com/integrations/api-tokens) for the store. API tokens need a Pro plan.

The built-in route needs more care: **Contact changed** fires for every field change, so add a condition on the field you care about.

## Good habits

- Build each workflow in a test client account first, with yourself as the contact.
- Use filters rather than **If/Else** steps where you can. A filtered trigger doesn't start at all, so it doesn't cost a run.
