# Job Triggers

Every job has exactly one of three trigger kinds: manual, cron, or push. Manual jobs need nothing else. Cron jobs need a schedule; push jobs need an event source and, optionally, a filter.

## Push sources

A push job subscribes to an event source:

- **Fours events** are the marketplace events Insulin already knows about. When created over REST, the source must match `suger.<entity>.<action>` — for example `suger.OFFER.ACCEPT`. Sources that don't match this pattern are rejected.
- **Third-party events** — GitHub (`github.<event>`), Google Calendar (`calendar.<event>`), and Gmail (`gmail.<event>`) — require a live OAuth connection to that provider and can only be created by asking the assistant, which registers the subscription for you.
- **Inbox** creates push jobs of its own to feed your [Inbox](/insulin/inbox/) rules: **Inbox · Gmail** or **Inbox · Outlook** watches your mailbox; **Inbox · Salesforce**, **Inbox · HubSpot** and **Inbox · Microsoft Dynamics 365** watch deal stage changes (`crm.opportunity.stage_changed`, `crm.deal.stage_changed`, `crm.dynamics.stage_changed`); and an **Inbox: …** job follows each Fours event your rules watch. They appear in the job list under the Inbox app, and turning one off stops the rules it feeds.

A push job's detail page shows its **Source** and, if one is set, its **Filter**.

:::info
Fours event payloads are scrubbed of personal data (emails, secrets, tokens) before the agent sees them or a run record is stored.
:::

## Partner program events

Your partner program in [PRM](/prm/) produces Fours events too. Ask the assistant for a job on one, and it uses these sources:

| Source | Fires when |
|--------|-----------|
| `suger.partnership.inbound` | A partner application is received |
| `suger.partnership.accept` / `suger.partnership.decline` | You accept or decline a partner application |
| `suger.partner_invitation.accept` / `suger.partner_invitation.decline` | A partner accepts or declines your invitation |
| `suger.partnership.promote` | A partner is promoted to a tier |
| `suger.journey.assign`, `suger.journey.complete_step`, `suger.journey.complete` | An onboarding journey is assigned, has a step completed, or is completed |
| `suger.journey.expire_soon` / `suger.journey.stalled` | A journey step is due soon, or the journey has had no activity for 7 days |
| `suger.commission.pending`, `suger.commission.update_proposed`, `suger.commission.payment_rejected`, `suger.commission.clawback` | A commission is pending, has a change proposed, has its payment rejected, or is clawed back |
| `suger.sugercosell.accept` | A partner deal registration or shared co-sell is accepted |

The job runs once for each event, and only for events in its own organization. The agent sees what the event is about — the partner company, the partnership, the journey and its progress, the tier, the deal and the commission amount — but never the people involved (no names or email addresses).

Two jobs worth asking for:

- *"When a new partner application comes in, research the applicant's company — what they do, who they sell to, whether they overlap with our customers — and send me a Slack summary saying whether they fit our partner program."*
- *"Every Monday at 8:00, post a partner digest to #partners: new applications, stalled journeys, and pending commissions."* (A cron job: it reads PRM through its tools rather than waiting for an event.)

For drafted emails on these events — a nudge on a stalled journey, an introduction when a deal registration is accepted — use an Inbox [rule](/insulin/inbox/#partner-program-rules) instead.

## Cron Scheduling

Cron expressions define when a scheduled job runs. Standard cron syntax is supported:

| Expression | Schedule |
|------------|----------|
| `0 9 * * 1-5` | Every weekday at 9:00 AM |
| `0 */6 * * *` | Every 6 hours |
| `0 0 1 * *` | First day of every month at midnight |
| `*/30 * * * *` | Every 30 minutes |

A cron job's detail page states the schedule in words in its header — `0 9 * * 1-5` reads *At 09:00 AM, Monday through Friday* — and shows the raw expression when you hover it; the job list does the same. Below it are **Last triggered** and **Next** timestamps. **Next** appears only when there is a genuine upcoming run — a disabled or just-re-enabled job has a frozen schedule, so no misleading "next run" is shown.

**The expression is the whole schedule.** There is no timezone field, no plain-interval field ("every 6 hours" is written as a cron expression, not chosen from a list), and no start or end date — a cron job has one cron expression and nothing else. Because no timezone is attached to it, `0 9 * * 1-5` means 09:00 on the service's clock rather than 09:00 wherever you happen to be reading the page; check the **Next** timestamp to see when a schedule actually lands for you. To stop a job on a given date, disable or delete it.

## Filter Expressions

Filters let you control which events actually trigger an agent run. When an event arrives on a push job — or when a cron tick fires with a payload — the filter expression is evaluated against the event payload. If the filter returns false, the run is skipped and recorded with the **Filtered** status.

Filters use [filtrex](https://github.com/m93a/filtrex) syntax — a safe, sandboxed expression language. The event payload is available under the `event` namespace.

**Examples:**

```
event.source == "aws-marketplace"
```

```
event.amount > 1000
```

```
event.action == "entitlement_created" and event.partner == "AWS"
```

```
lower(event.status) == "active"
```

**Available functions:** `lower()`, `upper()`, `includes()` (checks if an array contains a value).

**Dot notation** is supported for nested fields: `event.buyer.name`, `event.offer.info.commits`.

:::tip
If no filter expression is set, every event passes and triggers an agent run.
:::
