# Trigger tasks

> Tasks the AI runs the moment something happens in your business — a new lead, an order, a booking, a publish — with the details of what happened in hand.

Source: https://knowledge.estage.com/workspace/trigger-tasks/
Part of the ESTAGE knowledge base (https://knowledge.estage.com). Full corpus: https://knowledge.estage.com/llms-full.txt

---
A **trigger task** is a [scheduled task](/workspace/scheduled-tasks/) without a clock. Instead of
"every morning" it waits for an event — a lead, an order, a booking, a publish — and runs the
moment it happens, knowing exactly what happened. It's the difference between an assistant who
checks the inbox once a day and one who answers each message as it lands.

## The four triggers

| Trigger | What counts | What the run knows |
|---|---|---|
| **New lead** | a form on your site captures a contact; a funnel page captures a lead | name, email, phone, which form, every field they filled in |
| **New order** | an order form completes a purchase — card, PayPal, Razorpay, Square or Easy Pay Direct | product, amount, payment method, coupon, the buyer's name and email |
| **New booking** | a visitor books a meeting through your meeting element, free or paid | meeting type, date and time, the invitee's name and email, the meeting location |
| **Site published** | your site goes live — from the Publish button or from another task | the live URL and connected domains |

## Setting one up

Say it in the chat with **when**, **whenever** or **after**:

- "When a new lead comes in, add them to the *Newsletter* list and tag them *website*."
- "Whenever someone orders the Pro plan, send the order to my Telegram."
- "When a meeting is booked, put the invitee in the CRM with the tag *call-booked*."
- "After every publish, open the live site and check that every page loads."

The AI writes it up as a task — a name, self-contained instructions, the steps it will take —
and shows a card under its reply. **Confirm** activates it; nothing runs before that. From then
on it waits.

You can also create one by hand: **Settings → Scheduled Tasks → New task**, then choose
**On event** and pick the event.

## Recipes

**Leads**

- Enrich and file: tag the contact, add them to a list, note the source form.
- First response: send the welcome message the task describes through a connector (Telegram,
  WhatsApp, email).
- Route: forward leads that mention "enterprise" to a different list than the rest.

**Orders**

- Notify: post each order to Telegram or a Google Sheet with the product and amount.
- Fulfil: tag the buyer with the product they bought so an email automation picks them up.
- Update the site: after an order of a limited item, lower the "spots left" number on the page.

**Bookings**

- Prepare: add the invitee to the CRM, tag them, and note the meeting type and time.
- Remind yourself: send the booking to your own chat with the time in your zone.

**Publish**

- Check: open the live site and report anything broken — a missing image, a page that 404s.
- Announce: post "site updated" with the URL to a channel.
- Tidy: regenerate the sitemap description or the changelog page after each release.

## Bursts become one run

Events that arrive within the task's **batching window** — five minutes by default — are
folded into a single run. The run sees them as a list and handles them together: fifty sign-ups
from a campaign is one AI turn and one charge, not fifty. Set the window in the task (0 runs every
event on its own; up to a day).

While a run is busy, new events queue up and start one more run when it finishes — never two
runs of the same task at once.

## What the run is told

The run's brief lists the events it was started for, oldest first, with their details, and
tells the AI to act on **those** and not redo earlier ones (it also sees the reports of its last
runs). Passwords, tokens and card data are never part of an event.

## Per app

In a project with several apps, an event belongs to the app it happened in: an order on your
web app triggers that app's tasks, not the main site's. A trigger task is created in the app you
were editing when you asked for it.

## Good to know

- Trigger tasks follow the same rules as every unattended run: no questions, publishing only if
  you allowed it, waits a few minutes if you're actively chatting in that app, pauses after three
  failed runs and emails you.
- **Bookings** are reported by the meeting element on the page. Sites whose meeting element was
  added before trigger tasks existed need it re-added once (delete and add it again from the
  slash menu) before booking triggers fire.
- Events from outside Genesis — a deal changing stage in the CRM, an unsubscribe — aren't
  triggers yet.
