> ## Documentation Index
> Fetch the complete documentation index at: https://docs.livyapps.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Automate with Shopify Flow

Shopify Flow is Shopify's automation app: it lets you build "when this happens, do that" rules without writing code. Livy connects to Flow and adds two pieces: a **step** to adjust points (Adjust Livy points) and a **trigger** that fires when Livy adds points (Livy points awarded).

With them you can reward the customers you tag as VIP, subtract points when an order is refunded, or notify your team on Slack every time someone earns points.

## Before you start

* Your Livy plan must be **Starter or higher**. The Free plan does not include this integration.
* You need the **Shopify Flow** app installed. It is free and published by Shopify.

<Note>
  In Livy you can see the status of this integration under **Configurations > Shopify Flow**.
</Note>

## The step: Adjust Livy points

Add it as an action in any workflow. It adds or subtracts points for a customer.

| Field        | What it is                                                                   |
| ------------ | ---------------------------------------------------------------------------- |
| **Customer** | Whose points get adjusted.                                                   |
| **Points**   | Whole number other than zero. Positive adds, negative subtracts.             |
| **Reason**   | Optional, up to 400 characters. Stored on the customer's points transaction. |

### The sign is what decides

A **positive** number adds. A **negative** one subtracts. `0` is rejected, because a zero-point adjustment is not an adjustment.

<Warning>
  **If the customer does not have enough balance, we subtract as much as there is and the workflow still succeeds.** If you ask to subtract 500 and the customer has 100, those 100 are subtracted and the balance lands at zero: they are never left owing points and Flow does not mark the step as failed.

  This is on purpose. The normal case for a subtraction is penalizing a refund, and by then the customer has often already spent the points. Failing would fail exactly when you most want to collect.
</Warning>

## The trigger: Livy points awarded

Use it to start a workflow. It fires when Livy adds points.

| Field              | What it carries                                                                      |
| ------------------ | ------------------------------------------------------------------------------------ |
| **Customer**       | Who received the points.                                                             |
| **Points awarded** | How many points were granted.                                                        |
| **Points balance** | The customer's balance after the award.                                              |
| **Source**         | `order` if they come from a purchase, `earn_rule` if they come from an earning rule. |
| **Rule**           | The rule type that granted them. Empty when `Source` is `order`.                     |

### When it does NOT fire

* When you adjust points by hand from the Livy admin.
* When you import your customer or order history.
* When the points come from the Flow step itself.

<Warning>
  That last one matters most: without it, a workflow that awards points would trigger itself in a loop.
</Warning>

## Examples

### Reward a VIP customer

<Steps>
  <Step title="Trigger: Customer tags added (from Shopify)" />

  <Step title="Condition: the tag is VIP" />

  <Step title="Action: Adjust Livy points, with Points set to 500 and Reason 'VIP customer'" />
</Steps>

### Subtract points on a refund

<Steps>
  <Step title="Trigger: Order refunded (from Shopify)" />

  <Step title="Action: Adjust Livy points, with Points set to -200 and Reason 'Order refunded'" />
</Steps>

This is the case that justifies the step being an adjustment and not just an award.

### Notify the team when someone earns points from a rule

<Steps>
  <Step title="Trigger: Livy points awarded" />

  <Step title="Condition: Source equals earn_rule" />

  <Step title="Action: Send Slack message, using Points awarded and Rule in the text" />
</Steps>

## If something fails

Flow shows you the reason in the workflow run history. These are the messages Livy can return.

<Note>
  The messages are copied exactly as Flow shows them, so you can search this page for the one you see.
</Note>

| Message                                                                                        | What to do                                                             |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
| Your current plan does not include the Shopify Flow integration. Upgrade to Starter or higher. | Change plan under **Configurations > Subscription and usage**.         |
| Your Livy subscription is not active. Check the plan in the app to resume it.                  | Your subscription is paused or cancelled. Resume it from the app.      |
| Your loyalty program is paused in Livy.                                                        | Turn your program back on in Livy.                                     |
| You reached the order limit of your plan for this month.                                       | Wait for the next period or upgrade your plan.                         |
| Points must be a whole number other than zero. Positive adds, negative subtracts.              | Fix the **Points** field on the step.                                  |
| The reason cannot be longer than 400 characters.                                               | Shorten the **Reason** field.                                          |
| That customer has no email in Shopify, and Livy needs one to track their points.               | Add an email to that customer in Shopify.                              |
| We could not find that customer in Shopify.                                                    | The customer was deleted. Check the workflow trigger.                  |
| The step did not receive a customer. Check that the workflow trigger delivers one.             | The trigger you picked does not deliver a customer. Use one that does. |
| We could not find your store in Livy. Reinstall the app and try again.                         | Reinstall Livy.                                                        |
| Livy is uninstalled on this store.                                                             | Install Livy again.                                                    |

### The step retries on its own

If the problem is temporary (Livy does not answer for a moment), Flow retries the step for hours without you doing anything. The messages in the table above are the ones that do **not** fix themselves: there Flow stops and shows them to you.

### Re-running a workflow does not duplicate points

Every run has its own identifier. If Flow retries the same one, Livy recognizes it and does not adjust again.

***

#### <Icon icon="message-lines" />  We build Livy together.

Don't hesitate to reach out if you need help or have a suggestion. You can write to us at [info@livyapps.com](mailto:info@livyapps.com). We're here to help.
