# Segments

> Live groups of contacts built from rules, such as who added to cart and didn't order, that update every 15 minutes and can start journeys

URL: https://docs.lemuai.com/segments/overview
For: Everyone
Checked against LemuAI app version 1.0.12
Related: [Calculated fields](https://docs.lemuai.com/segments/calculated-fields), [Predictions](https://docs.lemuai.com/segments/predictions), [Contacts](https://docs.lemuai.com/contacts/overview), [Contacts and data](https://docs.lemuai.com/troubleshooting/contacts-and-data)

## Overview

A **segment** is a live list of contacts. Instead of adding people by hand, you describe who belongs, for example "added to cart in the last 7 days and didn't order", and Lemu keeps the list up to date. Segments update every 15 minutes.

Use segments to:

- Start a [journey](https://docs.lemuai.com/automation/introduction) for everyone who joins or leaves a segment
- See how many people match a set of rules before you message them
- Save a snapshot of the members as an ordinary contact list

<img src="/images/segments-builder.png" alt="The segment editor with two rules: contacts who can be messaged on email and contacts added in the last 90 days" />

## Create a segment

**Step: Start a new segment**

Go to **Audience → Segments** and click **New segment**.

**Step: Name it**

Give it a **Name** (for example "Cart abandoners, last 7 days") and an optional **Description**.

**Step: Add rules**

Click **+ Rule** to add each rule. Between two rules there's a small **and** picker: leave it on **and** (contacts must match every rule) or switch it to **or** (any one rule is enough). The word is the same for all rules at one level, so switching one switches them all; to mix **and** and **or**, put some rules in a group (below). The panel on the right shows how many contacts match and a few examples, and updates as you edit.

**Step: Save**

Click **Create segment**. Lemu works out who is in it, and the member list fills in shortly after.

## Rule types

| Rule | What it checks | Example |
| --- | --- | --- |
| **Contact property** | A contact field or custom field | First name is set, Tags include "vip", Number of calls `>` 3 |
| **Can be messaged** | Whether the contact can be messaged on a channel | can be messaged on whatsapp |
| **Did an event** | Whether the contact did (or didn't do) an event, at least a number of times, in the last N days | did `Purchase` at least 2 times in the last 30 days |
| **Message activity** | Whether a message was sent, delivered, read, failed or received on a channel | hasn't read a whatsapp message in the last 14 days |
| **In a list (Contacts)** | Whether the contact is in one of your contact lists | is in "Website Customers" |
| **Has records (Custom records)** | Whether the contact has [custom records](https://docs.lemuai.com/records/overview) of a type, optionally with filters | has at least 1 Loans record where status is overdue |
| **WhatsApp** | WhatsApp activity: replied, inside the 24-hour window, opted out, ordered, came from an ad | replied in the last 7 days |

### Contact properties

You can filter on **First name**, **Last name**, **Email**, **Phone**, **Company**, **Title**, **External id**, **Number of calls**, **Added on**, **Last called**, **Opted out of everything**, **Tags** and any custom field.

The choices depend on the kind of field:

- **Text**: is, is not, is in, is not in, contains, doesn't contain, starts with, is set, is not set
- **Numbers**: `=`, `≠`, `>`, `≥`, `<`, `≤`, is set, is not set
- **Dates**: in the last … days, not in the last … days, before, after, is set, is not set
- **Yes / no**: yes, no
- **Tags**: include, don't include, include any of, include none of

**is in** and **is not in** take a list of values separated by commas, for example `Delhi, Mumbai, Pune`, up to 500 values. Matching ignores upper and lower case. Event and record filters (**+ where…**) have them too.

Calculated fields (like total spent) and [predictions](https://docs.lemuai.com/segments/predictions) (like churn risk) appear in the property list marked "(calculated)". See [Calculated fields](https://docs.lemuai.com/segments/calculated-fields).

### Event rules

Pick an event name from the list (or type one), choose **did** or **didn't do**, and set **at least … times** and **in the last … days**. Leave the days empty to mean "ever". Click **+ where…** to narrow by the event's own properties, for example only purchases where `value` is more than 1000. You can add up to 10 filters to one event rule.

A rule on one of Meta's [standard events](https://docs.lemuai.com/website-pixel/standard-events) also counts events stored under its older name, so did `Purchase` includes orders recorded as `order_placed`.

Event rules use events received through the [Events API](https://docs.lemuai.com/api-reference/events/trigger), Shopify and WhatsApp.

**Note:** Website page and product views from your [Tracking Sources](https://docs.lemuai.com/website-pixel/overview) (**Settings → Tracking Sources**) are included in event rules only once this is turned on for your workspace. Until then, the builder shows a note saying so. Contact support to have it turned on.

### Groups

Click **+ Group** to add a set of rules that are checked together, with their own **and** / **or** between them. For example: "In a list (Contacts) is VIP" **and** (did `InitiateCheckout` **or** did `ViewContent`). Use **Rule in group** to add rules inside it. Groups go one level deep.

The summary under the builder (**In plain words**) reads the whole segment back as a sentence, with brackets around groups, so you can check it says what you mean.

## Limits

| Limit | Value |
| --- | --- |
| Rules in one segment | 30, counting rules inside groups |
| Filters on one event or records rule | 10 |
| Days in a "last … days" rule | 1 to 3,650 |
| How often members update | Every 15 minutes |

## Working with a segment

Open a segment to see its **Members** list and when it was last updated. From there you can:

- **Save** your changes to the name or rules. Members update a moment later
- **Refresh now** to update members right away instead of waiting for the next 15 minute update
- **Copy to a list** to save today's members as a regular contact list. The list doesn't change when the segment does
- **Delete** the segment. Journeys that start from it stop firing

If an update fails, the reason is shown under the segment name and in the **Updated** column on the Segments page.

## Start a journey from a segment

In a journey's trigger, under **Start from a segment**, choose **Enters a segment** or **Leaves a segment**, then pick the segment. The journey runs for each contact who joins (or leaves), with their phone available as `{{phone}}`.

- People who were already in the segment when you created or edited it don't start the journey. Only people who join or leave after that do.
- With **Exit when the contact leaves the segment** turned on (the default), someone who leaves the segment while the journey is waiting doesn't get its remaining messages or calls.

**Warning:** If more than 5,000 contacts join or leave a segment in a single update, the members still update but journeys are not started for that change. This protects you from accidentally messaging a very large group after a big edit.

See [Nodes and triggers](https://docs.lemuai.com/automation/nodes-and-triggers) for the rest of the journey setup.

## Next steps

- [Custom records](https://docs.lemuai.com/records/overview): Store loans, policies or bookings and use them in segment rules.
- [Importing contacts](https://docs.lemuai.com/contacts/import): Bring your contacts in from a file or Google Sheet.
