Schedules & Webhooks
Time-based and event-based workflow triggers.
Schedules & Webhooks
Both Schedules and Webhooks are space-scoped triggers: they live under a specific space and fire executions for a workflow in that space.
Schedules
A Schedule fires a workflow on a cron expression.
Schema
Fire Logic
SchedulesService.fireDueSchedules() is called by a NestJS @Cron task every minute:
- Queries schedules where
enabled = trueANDnextRunAt <= now() - JOINs
spacesto getworkspaceId - Calls
ExecutionsService.createFromTrigger(spaceId, workspaceId, workflowId, 'schedule', {}) - Updates
lastRunAtand computes the nextnextRunAtfrom the cron expression
The workspaceId JOIN is necessary because schedules only store spaceId after the space layer was introduced. The join is done in bulk once per cron tick, not per execution.
API Endpoints
| Method | Path | Description |
|---|---|---|
GET | /workspaces/:wId/spaces/:sId/schedules | List schedules |
POST | /workspaces/:wId/spaces/:sId/schedules | Create schedule |
PATCH | /workspaces/:wId/spaces/:sId/schedules/:id | Update |
PATCH | /workspaces/:wId/spaces/:sId/schedules/:id/toggle | Enable / disable |
DELETE | /workspaces/:wId/spaces/:sId/schedules/:id | Delete |
Webhooks
A Webhook fires a workflow when an HTTP POST request is received at its unique URL.
Schema
Trigger URL
Each webhook has a public endpoint:
This endpoint is @Public() (bypasses AuthGuard). If a secret is configured, the X-Webhook-Signature header is verified before processing.
Trigger Logic
WebhooksService.trigger(webhookId, payload):
- Fetches the webhook row, verifies
enabled = true - JOINs
spacesforworkspaceId - Verifies HMAC signature if
secretis set - Calls
ExecutionsService.createFromTrigger(spaceId, workspaceId, workflowId, 'webhook', payload) - Updates
lastTriggeredAt
API Endpoints
| Method | Path | Description |
|---|---|---|
GET | /workspaces/:wId/spaces/:sId/webhooks | List webhooks |
POST | /workspaces/:wId/spaces/:sId/webhooks | Create webhook |
PATCH | /workspaces/:wId/spaces/:sId/webhooks/:id | Update |
DELETE | /workspaces/:wId/spaces/:sId/webhooks/:id | Delete |
POST | /webhooks/:id/trigger | Public trigger endpoint |