# Start a sequence (https://www.getfounderhq.com/docs/sequences/start-a-sequence)

The trigger at the top of a sequence decides who enters it and when.
Click it and choose under **Starts when**.

| Trigger | A person enters when |
| --- | --- |
| **An event happens** | They do something your product reports, such as signing up |
| **Enters a segment** | They start to match a segment |
| **Leaves a segment** | They stop matching a segment |
| **A date arrives** | A date stored on them comes up, such as a renewal date |
| **A repeating schedule** | The day comes round, for everyone in a segment |
| **A webhook is called** | Another system calls an address FounderHQ gives you |
| **Manual only** | You enroll them yourself |

## An event happens

Enter the **Event name**, exactly as your product sends it. See
[Getting started](/analytics/getting-started) for sending events.

**Filter by event property** narrows it: only `purchase` events where
`plan` is `pro`. Every filter must match.

An event older than 7 days does not start a sequence.

## Enters or leaves a segment

Pick the segment. You build segments in
[Sequences → Segments](https://app.getfounderhq.com/sequences/segments), from rules about a person's
attributes, events, visits, devices, and consent.

## A date arrives

| Setting | Choices |
| --- | --- |
| **Date attribute** | The date on the person to use |
| **Repeats** | **Exact date**, or **Every year** for a birthday or an anniversary |
| **When** | **Days before**, **On the day**, or **Days after** |

Then set the time of day and the time zone.

## A repeating schedule

Choose **Who**, a segment, and **Every** day, week, or month.

Set the sequence's **Re-entry policy** to something other than **Never**.
Otherwise each person enters once and gets nothing on the later dates.
FounderHQ stops you from publishing until you do.

## A webhook is called

Use this to start a sequence from a tool that can call an address: a form
builder, a CRM, an automation tool.

1. Choose how to find the person under **Match contacts by**: **Email**,
   **Phone**, or **External ID**.
2. Under **Field in the payload**, name the field of the request that
   holds it.
3. Turn on **Create unknown contacts** to add people FounderHQ has not
   seen.
4. Copy the request FounderHQ shows, and give its address to the other
   tool.

The address works once the sequence is published. Set an **Auth secret**
so that only your tool can call it.

## Manual only

Nobody enters by themselves. Press **Enroll** at the top of a published
sequence, then choose a whole segment or pick people one by one.

People already in the sequence are skipped, not added twice.

## From your own server

Your backend can enroll a person in any published sequence with one
request. Use it when your code already knows the moment.

Create a secret key with **Add people to sequences**: see
[API keys](/account/api-keys).

```bash
curl https://app.getfounderhq.com/api/enrollments \
  -H "Authorization: Bearer fhq_sk_XXXX" \
  -H "Content-Type: application/json" \
  -d '{
    "sequenceId": "SEQUENCE_ID",
    "contact": { "externalId": "user_8421", "email": "jane@acme.com" },
    "variables": { "plan": "pro" }
  }'
```

| Field | What it is |
| --- | --- |
| `sequenceId` | The sequence to enter. It is the last part of the builder's address. |
| `contact` | Who to enroll: `externalId`, `email`, or `phone`. FounderHQ creates the contact if it is new. |
| `contactIds` | Instead of `contact`: up to 1,000 FounderHQ contact IDs |
| `variables` | Values for the sequence's variables |

A successful request answers `201`.

In a message, a variable reads `{{ vars.plan }}`.

## Verify

After you publish, cause the trigger once with your own account. Open
[Sequences → Message log](https://app.getfounderhq.com/sequences/messages): the first message of the sequence is
in the log.
