Automation
Nexus supports event-driven automation through a combination of Edge Functions, database triggers, scheduled jobs, and n8n workflows.
Automation primitives
Trigger
An event that starts an automation. Examples:
- New inbound message received
- Order status changed to
shipped - Abandoned cart detected (time-based)
- Shopify webhook received
- Scheduled cron interval
Action
An operation performed when a trigger fires. Examples:
- Send a WhatsApp template message
- Update an order status
- Create a task for a team member
- Sync data to an external system
- Run an AI annotation job
Automation Rule
A stored configuration that maps a trigger to one or more actions with optional conditions. Stored in the automation_rules table.
Built-in automations
| Automation | Trigger | Action |
|---|---|---|
| Abandoned cart recovery | Cart not converted within threshold | Send WhatsApp template via abandoned-carts-scan-send |
| Stale session cleanup | Session idle beyond timeout | Close session via close-stale-sessions |
| CRM nightly features | Scheduled (nightly) | Compute CRM features via crm-nightly-features |
| AI CS annotation | New conversation closed | Run annotation via ai-cs-annotator |
| Shopify order sync | Shopify webhook event | Sync order via shopify-webhook |
| Tracking update | Courier webhook event | Update AWB status via tracking-webhook |
n8n integration
Complex multi-step automations that span multiple systems are orchestrated via n8n:
- Nexus Edge Functions send events to n8n webhook URLs.
- n8n workflows process the event and can call back into Nexus via Edge Functions.
- This decouples Nexus from complex orchestration logic while keeping it extensible.
Creating custom automations
Custom automation rules can be configured through the Settings UI. Each rule specifies:
- Event type — the trigger condition.
- Filters — optional conditions (e.g., only for orders above a certain amount).
- Actions — one or more actions to execute.
- Schedule — for time-based triggers, the cron expression or interval.