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

# Recipe: SaaS customer lifecycle emails

> How to send onboarding, dunning and churn emails to your customers with workflows.

For SaaS companies, there are a few important events in a customer lifecycle that email can help with.

* **Acquisition emails** are emails sent after a user signs up for a waitlist, platform or newsletter.
* **Onboarding emails** help brand new users get familiar with—and get the most out of—your product.
* **Retention emails** keep your users engaged long-term.
* **Re-engagement emails** attempt to get users active again if they haven't used your platform recently.
* **Dunning emails** help reduce churn by prompting the user to re-activate a subscription or fix payment issues.
* **Re-activation emails** attempt to bring users back after a cancellation.

With Loops, you can easily set up workflows plus our API (or an integration) to help with each of these use cases.

## How it works

To get this set up in Loops, the idea is to create a [workflow](/workflows) for each of the types of email you want to send. So there would be a workflow for activation emails and a workflow for dunning emails and so on.

A workflow is like an email sequence containing emails, time delays, audience filters and an initial trigger.

We will use a [custom contact property](/contacts/properties) called `subscriptionStatus` to enter users into each of the workflows at different times in their subscriptions.

This property is used as the [workflow trigger](/workflows/triggers); if the property is ever changed using [an integration](/integrations) or the [Loops API](/api-reference/intro), we trigger a workflow, which will send emails to the contact.

## Add a contact property

First, let's add the contact property to the audience in Loops.

Go to your [Audience page](https://app.loops.so/audience). Click on a table header to show the dropdown then select **Add property**.

Enter "Subscription status" into the **Name** field and make sure **String** is selected in the "Type" field. (You'll notice that the "stored name" of your property is `subscriptionStatus`. This is the name we'll use in the API and integrations).

Click **Add Property** when you're done. Your new property was added to the far right of the Audience table.

## Update contacts

Now you can click on contacts and update the value manually one-by-one, or use the API or an integration to update contacts programmatically.

To update contacts in bulk you can download your Audience as a CSV, update values and [re-upload the file](/add-users/csv-upload).

## Create workflows

The next step is to create the workflows, one for each type of email. Repeat the following step for each of the different subscription statuses you want to send emails for.

Go to the [Workflows page](https://app.loops.so/loops) in your account and click **New**.

Select the **Contact update** option, which will create a new workflow using that trigger.

<img src="https://mintcdn.com/loops/ffhyeftgaYR0NShT/images/triggers.png?fit=max&auto=format&n=ffhyeftgaYR0NShT&q=85&s=99ccf7c64edebce1dc92f92d75f3f4d5" alt="Select trigger" width="2280" height="1409" data-path="images/triggers.png" />

You will enter the [workflow builder](/workflows). Click on the **Contact updated** node to set up the workflow trigger.

### Set up the trigger

1. Select the "Subscription Status" property from the **When** dropdown.
2. The **Changes from** dropdown should have "Any value" selected.
3. Next you need to specify what value Loops should look out for to enter users into the workflow.
   For example, for onboarding emails, you can choose "is empty" from the **To** dropdown. For re-activation emails select "Equals" from the **To** dropdown and enter a relevant value like "Canceled".
4. **Trigger time** should be set to "Every time"; this will make sure users are entered into the workflow every time that the Subscription Status value matches.

### Create emails

Now create the email(s) you want to send from each workflow.

You can add as many emails as you like into each workflow, separated with timers. If you want to send emails to certain groups of contacts, you can use Audience filters in your workflow.

We have a range of [email templates](https://app.loops.so/templates) available, which you can use as a base for all of your subscription emails.

<img src="https://mintcdn.com/loops/OG31ikb--92jQDlq/images/getting-started.png?fit=max&auto=format&n=OG31ikb--92jQDlq&q=85&s=3ca8868a9bddc666b8293dc9ed17977f" alt="Templates" width="2280" height="1284" data-path="images/getting-started.png" />

If you want to use cohesive branding in your emails, make use of [themes](/creating-emails/editor#themes) in the editor.

<img src="https://mintcdn.com/loops/W7EWSDUW0GR-XWrp/images/message-visual.png?fit=max&auto=format&n=W7EWSDUW0GR-XWrp&q=85&s=e2c7088ffd4d20ac66b5fee7a1756010" alt="Editor panel" width="2280" height="1953" data-path="images/message-visual.png" />

## Update the Subscription status value

The final step is to make sure that your contacts have the correct "Subscription status" value assigned to them in Loops.

This will make sure they are in the correct workflows at the correct moment within their subscription.

Using the API you can make a simple `PUT` call to the [Update contact endpoint](/api-reference/update-contact), with a request containing the contact's email address and subscription status.

(You can also add more contact properties in this call if you want to add more data to the contact in Loops.)

<Note>
  Using the Update contact endpoint will either create or update a contact in
  Loops using the provided email address.
</Note>

```json theme={"dark"}
{
  "email": "test@example.com",
  "subscriptionStatus": "Canceled"
}
```

Many of [our integrations](/integrations) allow syncing of contact data. Just make sure you create or update contacts and include the current `subscriptionStatus` value.

Now you have set up different workflows to trigger when the "Subscription status" value changes, your users will be automatically entered into each workflow and receive the correct emails at the correct times during their subscription lifecycle.

## Example workflows

Here are some example workflows you can create along with a suggested trigger and workflow contents.

### Onboarding

Sent to brand new users.

* **Trigger**: Contact added or Contact updated (e.g. `subscriptionStatus` is empty).
* **Audience filter**: Match the trigger (e.g. `subscriptionStatus` is empty).
* **Workflow contents**: 1–5 welcome and onboarding emails over the first 30 days.

### New subscribers

Sent to users who just started paying.

* **Trigger**: Contact updated (e.g. `subscriptionStatus` changes to "Paying").
* **Audience filter**: Match the trigger (e.g. `subscriptionStatus` equals "Paying").
* **Workflow contents**: 1–3 emails about paid-only features over the next 3 days.

### Dunning

Sent to customers who had a first failed payment.

* **Trigger**: Contact updated (e.g. `subscriptionStatus` changes to "Failed").
* **Audience filter**: Match the trigger (e.g. `subscriptionStatus` equals "Failed").
* **Workflow contents**: 1–3 emails during your dunning period.

### Churn

Sent to customers who have just canceled their payments.

* **Trigger**: Contact updated (e.g. `subscriptionStatus` changes to "Canceled")
* **Audience filter**: Match the trigger (e.g. `subscriptionStatus` equals "Canceled").
* **Workflow contents**: 1 email saying goodbye and asking for feedback.
