Skip to main content

The closed vocabulary

Every playbook starts from one of exactly four trigger types. Nothing else. The closed vocabulary is deliberate. It keeps agents auditable, predictable, and easy to reason about.

Schedule

A cron-style schedule. The runtime fires the playbook at the specified time.

Common cron patterns

Timezone handling

For personal-scope playbooks, the timezone resolves to the user’s timezone. For app-wide playbooks, the timezone is set on the trigger.

When to use schedule

  • Recurring digests, briefings, and reports
  • Time-based SLA enforcement (“any open ticket older than 24 hours”)
  • Periodic refreshes (“recompute pipeline forecast every Monday”)

Data change

A change-stream event on a collection. The runtime observes inserts, updates, and deletes, and fires the playbook when an event matches the filter.

Operations

You can listen to multiple operations in one trigger:

Field-level filters

The where clause can reference the new state of the record. For updates, it can also reference what changed:

When to use data change

  • Reactive work tied to a state change (“when a deal moves to lost…”)
  • Onboarding flows (“when a new contact is created…”)
  • Anomaly detection (“when an order’s total exceeds $50,000…”)
The change-stream pattern is the same one Gainable uses internally for the email daemon and other observation services. The runtime does the heavy lifting; the playbook just describes the filter.

Webhook

An inbound HTTP request from an external system. The runtime exposes a unique URL per webhook and fires the playbook when a request arrives.

How webhook URLs work

When you configure a webhook trigger, Gainable provisions a URL like:
You configure the source system to POST to that URL. The runtime verifies the signature (when applicable), parses the body, and exposes it as trigger.body to the playbook.

Common sources

When to use webhook

  • Reacting to events in external systems you don’t own
  • Bridging Gainable apps to third-party tools
  • Receiving callbacks from long-running external jobs
See Connect outbound for the full inbound and outbound integration story.

User-triggered

An explicit button click in the app. A user opens a record (or a page) and clicks a button labeled “Run this playbook now.”

How it appears

Gainable renders user-triggered playbooks as buttons in the Autopilot widget on the page you specified. When the user clicks:
  1. The runtime fires the playbook with trigger.user_id set to the clicker
  2. The playbook runs with that user’s permissions
  3. The resulting draft (if any) lands in their personal Autopilot inbox

When to use user-triggered

  • On-demand drafts (“write me a follow-up for this deal right now”)
  • Bulk operations the user wants to start manually
  • Anything the user wants control over the timing of, even if the rest of the playbook is automatic

Choosing the right trigger

If two answers are yes, you probably have two playbooks pretending to be one. Split them.

Best practices

A schedule trigger that scans a collection every 5 minutes is almost always worse than a data_change trigger that fires only on the relevant transition. Faster, cheaper, and more accurate.
The more selective the trigger’s where clause, the less work the runtime does and the cleaner your action log gets.
A daily briefing fired at 8 AM UTC is 3 AM in California. Bind the timezone to the user.
Webhook triggers can be tested by replaying captured payloads. Always do this before going live.

Learn more

Playbooks

Trigger, steps, and guardrails together

Tools

What playbooks call after the trigger fires

Connect outbound

Webhooks and external systems

Inbox

Where user-triggered buttons render