E-mail tasks: configuration, processing engine and scheduling

Data model of e-mail tasks, sources and processing adapters, save validation, schedule synchronisation, manual and background runs, and the gaps in permissions and content scope.

An e-mail task is a configuration-driven, folder-based document processor: source (Gmail API, Gmail IMAP, MS365), processing adapter, target storage (Drive, document centre folder, company folder or local directory) and schedule. Runs are executed by the e-mail task engine, either manually or by the scheduler's email_task job.

Data model

Table names carry the installation's own prefix in the database.

TableRoleRelation
emailtasktask: code, name, source and login, filters, handler, params_json, folders, target, timing, statustarget company
company_foldercompany Drive folders by typecompany
cron_queuethe task's scheduler templatepayload email_task_id

Processing adapters (whitelist): store_only, link_invoice, nemzetiutdij, rackforest, otpkelfo, googlews, anthropic, foxpost, github, ingatlancom.

Saving and running

  1. Validation: code [a-z0-9_-]{2,32}, unique (empty = handler name); name; source-dependent required fields (IMAP password and MS365 secret only when adding, write-only); whitelisted handler; valid JSON parameters; required processed folder; target storage (local path or document centre/company folder; not needed for ingatlancom); shared timer (5–1440 minutes, weekday, monthly 1–28).
  2. After saving, syncSchedule creates, updates or deactivates the cron template (deactivates for an inactive task, missing target company or wrong interval). For a new row the ID is written back.
  3. runnow: the engine runs at once within the time budget (job_sync_budget, default 8 s) and queues the rest for continuation; error for an inactive task.
  4. delete: deletes the tasks and their cron templates.
  5. Helpers: folders (mailbox folders with the given login), companyfolders, drivefolders (at most 20 matches), addfolder, companyaccount (thin forward to the document centre's storage endpoint with ctx=emailtask).
  6. Background: email_task job → catalog task/emailtask::processForCronqueue; the payload's email_task_id narrows to one task, company and time come from the task.

Error keys

error_code, error_code_exists, error_gmail_account, error_imap*, error_ms365*, error_handler, error_params_json, error_processed_required, error_storage_configuration, error_v2_migration, error_task_inactive, error_schedule_missing, error_interval.

Permissions

  • list (unclassified); add has no catalogue row, so edit decides (canSave); edit on all other endpoints; delete; debug. The BASE key statusdelete has no endpoint; its behaviour cannot be determined.
  • Content scope (companyInScope) only on companyfolders, drivefolders and addfolder. The list query does not narrow to the allowed companies.

Known limitations

The list shows tasks of every company without content scope; saving and running do not check the content scope of the target company.