Skip to main content

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

AutomationTriggerAction
Abandoned cart recoveryCart not converted within thresholdSend WhatsApp template via abandoned-carts-scan-send
Stale session cleanupSession idle beyond timeoutClose session via close-stale-sessions
CRM nightly featuresScheduled (nightly)Compute CRM features via crm-nightly-features
AI CS annotationNew conversation closedRun annotation via ai-cs-annotator
Shopify order syncShopify webhook eventSync order via shopify-webhook
Tracking updateCourier webhook eventUpdate 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:

  1. Event type — the trigger condition.
  2. Filters — optional conditions (e.g., only for orders above a certain amount).
  3. Actions — one or more actions to execute.
  4. Schedule — for time-based triggers, the cron expression or interval.