Features
Automation — Workflow Engine
The Automation module lets agencies define trigger-based rules that execute automatically when business events occur. It replaces the manual follow-up checklist that every agency relies on but rarely maintains.
- Free: Automation hidden entirely
- Studio: Automation unlocks — 3 active workflows, 200 runs/month, run history log
- Higher plates: caps scale up (Sales 10/500, Growth 25/2,000, Full Loop 50/10,000, Agency 100/25,000)
Triggers
| Trigger | When it fires |
|---|---|
| deal_stage_change | A deal moves to any stage (configurable: from/to stage) |
| lead_converted | A lead is converted to a contact and deal |
| no_activity_days | A deal sits without any new activity for cfg.days days (hourly cron) |
| task_overdue | A task crosses its due_date and is still not done (hourly cron) |
| task_assigned | A task is assigned to a user |
| bill_approved | An AP bill is approved |
| invoice_overdue | An invoice crosses its due date unpaid (hourly cron) |
Actions
| Action type | What it does |
|---|---|
| create_task | Creates a task in a chosen project (requires one — tasks.project_id NOT NULL) |
| notify_user | In-app notification (honours user notification preferences) |
| send_email | Sends an email via the connected Gmail/Outlook channel (Resend fallback) |
| update_field | Updates a deal field; skips with no_deal_context on non-deal triggers |
| create_project | Creates a project, linked to the triggering deal when present |
| create_deal | Creates a deal, linked to the triggering contact when present |
| add_tag | Adds a tag to the triggering contact / lead |
| log_activity | Logs a note activity on the triggering deal / contact (supports {{tokens}}) |
User-facing behavior
- Workflow list (
/crm/automation): Active and inactive workflows with name, trigger type, action count, last run, status toggle. - Create workflow: Select trigger, configure conditions (from/to stage for deal triggers), add actions in order. A Template Gallery row offers 6 one-click starter recipes that pre-fill name + trigger + action + conditions.
- Activate/deactivate: Toggle without deleting.
- Run History (Studio,
automation:workflow-logs): Accordion list of recent executions below the workflow list. Shows time, trigger type, entity link, run status. Expanding shows per-action results.
Run history schema
Each workflow execution creates a row in workflow_runs and per-action rows in workflow_run_actions.
| Field | Meaning |
|---|---|
| trigger_type | deal_stage_change or lead_converted |
| trigger_entity_id | UUID of the deal or lead that triggered the run |
| status | started, completed, partial, or failed |
| metadata | e.g. { fromStage, toStage, dealTitle } |
Important: Workflow logging is non-blocking. If logging fails, the actual workflow action still completes. An org over its monthly automation:runs cap still has workflows fire — only the log entry is suppressed.Technical reference
| File | Purpose |
|---|---|
| actions/workflows.ts | Trigger + action CRUD — createWorkflowTrigger, updateWorkflowTrigger, setWorkflowActive, deleteWorkflowTrigger, createWorkflowAction, deleteWorkflowActionsForTrigger (there is no workflow-actions.ts) |
| actions/workflow-runs.ts | Run history — listWorkflowRuns (cursor-paginated) |
| actions/workflow-execution.ts | runDealStageChangeWorkflows, runLeadConvertedWorkflows |
| actions/workflow-execution-events.ts | runBillApprovedWorkflows, runTaskAssignedWorkflows |
| lib/automation/workflow-execute-action.ts | Shared action executor (all 8 action types) |
| lib/automation/workflow-run-logging.ts | tryStartWorkflowRun, logWorkflowActionResult, completeWorkflowRun |