# Zapier

> Connect Leal to Zapier with an API token and your Account ID, then use Leal triggers and actions in your Zaps.

Zapier links Leal to thousands of other apps. A Zap is one automation: a trigger in one app, then one or more actions. You need a Pro plan, because Zapier connects with an API token.

## Connect Leal to Zapier

1. In Leal, create an API token named "Zapier" on the [API page](https://app.getleal.com/api_tokens). See [API tokens](https://docs.getleal.com/integrations/api-tokens).
2. Copy **Your Account ID** from the top of the [Integrations page](https://app.getleal.com/integrations).
3. Open the [Leal app on Zapier](https://zapier.com/apps/leal/integrations) and start a Zap, or click **Open the Leal integration** on the Integrations page.
4. When Zapier asks you to connect Leal, paste the **API Token** and **Account ID**.
5. Pick a template or build your own Zap.

You can also click **Browse Integrations** on the Zapier card in Leal to search Zap templates without leaving Leal.

## Triggers

| Trigger | Fires when |
| --- | --- |
| **New Customer** | A new customer is created in your store, from any source. |
| **Stamp Earned** | Stamps are added to a customer's card. The **Entry Type** says how: a scan, the API, an adjustment, welcome stamps (initial) or a referral. |
| **Reward Redeemed** | A customer redeems a reward. Includes the reward's name and the stamps spent. |
| **Referral Rewarded** | A referred friend's card is stamped for their first visit, so both customers get their referral stamps. |

Each trigger includes the customer's name, email and phone, so you can pass them on to the next step.

## Actions and searches

| Action | What it does |
| --- | --- |
| **Create Customer** | Adds a customer to your store. Needs an email or a phone number. You can choose a **Loyalty Card** to give them one straight away. |
| **Add Stamps** | Adds a number of stamps to a customer's card. Pick the customer and the **Loyalty Card**. |
| **Find Customer** | Looks a customer up by name, email or phone, or by their ID in another system. Use it before **Add Stamps** when the trigger comes from another app. |

## Example Zaps

- **New Customer** in Leal, then add a subscriber in your email tool.
- A completed booking in your booking app, then **Find Customer**, then **Add Stamps**.
- **Reward Redeemed**, then add a row to a Google Sheet.

## Managing Zaps

Each Leal trigger adds an endpoint to Leal's **Webhooks** page, labelled **Zapier**. It's easiest to manage from Zapier: turning the Zap off removes the endpoint. If you delete it from Leal while the Zap is on, the Zap stops receiving events.

## Gotchas

- **Wrong store?** Check the Account ID in the Zapier connection. It decides which store the Zap works with.
- **Stamp Earned fires for every kind of stamp**, including welcome stamps and referral stamps. Add a Zapier filter on **Entry Type** if you only want scans.
- **Zaps stop if your token is revoked**, or if you're removed from the store. Reconnect Leal in Zapier with a new token.

## Read more

The Zapier page on the Leal website lists popular templates: [getleal.com/integrations/zapier](https://www.getleal.com/integrations/zapier).
