1. Confirm prerequisite settings
In your environment configuration, ensure the following are set:CRON_WEBHOOK_TOKENGDPR_ACTIVITY_LOG_RETENTION_MONTHSGDPR_REPORT_FILE_RETENTION_HOURS
2. Create or review n8n schedules
For each background task, configure an n8n workflow with:- Schedule Trigger node
- HTTP Request node (
POST) - URL set to your cron webhook endpoint:
/api/cron/webhook - Header:
X-Webhook-Token: <your token> - Body fields:
script: target cron filenametriggered_by:n8n
3. Use approved script names only
The cron webhook accepts only allowlisted script names. If a script is not approved, the webhook returns an authorization error. If you add a new cron script:- add the script file
- add it to webhook allowlist
- create/update n8n workflow
- define concurrency behavior where applicable
4. Recommended scheduling pattern
Use frequent schedules for lightweight maintenance and less frequent schedules for heavy work. Typical examples:- Session cleanup: hourly
- GDPR cleanup: hourly or daily (based on policy strictness)
- API history cleanup: daily
- Commit archive purge: daily
- Heavy optimize/analyze passes: off-peak windows
5. Validate retention behavior
After schedule changes:- run the workflow manually once
- confirm cron log file updates
- confirm expected rows/files are removed
- confirm activity entry exists in
user_activity_log
GDPR_REPORT_FILE_RETENTION_HOURS.
6. Verify audit trail
For cleanup/purge jobs, confirm an activity record exists with:- activity type for the job
- script name
- deleted counts
- execution type as
cron
7. Troubleshooting
If a job does not run:- check n8n workflow status and last execution
- verify webhook token header
- verify script name is allowlisted
- check cron script log file in
cron/logsorlogs - test script directly via CLI for syntax/runtime issues
Related pages
- Cron capability overview: /features/cron-jobs
- Admin panel controls: /features/admin
- Integrations setup: /configuration/integrations
- Webhook API reference: /api/webhooks#cron-webhook