Background Jobs (Inngest Functions)
Background Jobs (Inngest Functions)
The platform uses Inngest to run reliable background jobs and scheduled cron tasks. All functions are registered in src/app/api/inngest/route.ts via the Inngest serve() handler.
Registered Functions
Core Platform
| Function | Trigger | Purpose |
|---|---|---|
usageAggregate | Event | Aggregates usage metrics |
webhookDeliver | Event | Delivers outbound webhooks |
auditCleanup | Cron | Purges old audit log entries |
inviteEmail | Event | Sends user invitation emails |
eSigning
| Function | Trigger | Purpose |
|---|---|---|
eSigningRequeue | Event | Requeues failed eSigning requests |
signableWebhookProcess | Event | Processes Signable webhook callbacks |
Tenancy Lifecycle
| Function | Trigger | Purpose |
|---|---|---|
actionRequiredScan | Cron | Scans for tenancy actions that require attention |
actionRequiredNotify | Event | Sends notifications for required actions |
endTenancyScan | Cron | Identifies tenancies approaching their end date |
Renewal Notifications
| Function | Trigger | Purpose |
|---|---|---|
renewalNotificationScan | Cron | Scans for upcoming renewals |
renewalNotificationSend | Event | Dispatches renewal notification emails |
Payments
| Function | Trigger | Purpose |
|---|---|---|
paymentCompletedSync | Event | Syncs completed payment records |
autoChargeOverdue | Cron — daily 9 AM | Auto-charges past_due subscriptions that have a stored payment method |
Offer Workflow
| Function | Trigger | Purpose |
|---|---|---|
offerInvitationEmailFn | Event | Sends offer invitation emails to applicants |
offerSubmittedAgentNotifyFn | Event | Notifies agents when an offer is submitted |
Rent Guarantee Insurance (RGI)
| Function | Trigger | Purpose |
|---|---|---|
rgiPolicyActivate | Event | Activates an RGI policy after completion |
Compliance
| Function | Trigger | Purpose |
|---|---|---|
complianceCertDistribute | Event | Distributes compliance certificates to relevant parties |
AML / Identity Checks (Blinc-UK)
| Function | Trigger | Purpose |
|---|---|---|
amlCheckInitiate | Event | Sends an AML identity check request to the Blinc-UK API |
amlCheckProcessResult | Event | Processes the AML check result returned via Blinc-UK webhook |
Added in v0.3.1 — these functions were previously unregistered and silently dropped all events.
Referencing (Blinc-UK)
| Function | Trigger | Purpose |
|---|---|---|
blincUkWebhookProcess | Event | Processes Blinc-UK referencing webhook callbacks and updates reference request statuses |
Added in v0.3.1 — previously unregistered.
Billing Webhooks (Calmony Pay)
| Function | Trigger | Purpose |
|---|---|---|
calmonyPayCheckoutCompleted | Event | Handles checkout.session.completed → links the new subscription to the organisation |
calmonyPayInvoiceSync | Event | Processes invoice.paid and invoice.payment_failed events |
calmonyPayPaymentSync | Event | Resolves pending overdue payments on payment_intent.succeeded |
calmonyPaySubscriptionSync | Event | Syncs subscription lifecycle events: created, updated, and deleted |
Added in v0.3.1 — all four functions were previously unregistered, meaning billing webhooks from Calmony Pay were silently dropped.
GDPR Data Retention
| Function | Trigger | Purpose |
|---|---|---|
dataRetentionScan | Cron — Sundays 4 AM | Scans all tables with a configured retention policy and inserts records into data_retention_flags for deletion processing, per GDPR Article 5(1)(e) |
Added in v0.3.1 — previously unregistered. A SQL bug referencing a non-existent
eligible_atcolumn was also fixed in this release.
How Functions Are Registered
All functions must be explicitly listed in the functions array passed to serve() in src/app/api/inngest/route.ts:
// src/app/api/inngest/route.ts
import { amlCheckInitiate } from "@/inngest/functions/aml-check-initiate";
// ... other imports
export const { GET, POST, PUT } = serve({
client: inngest,
functions: [
amlCheckInitiate,
// ... all other functions
],
});
Important: Creating a new function file under
src/inngest/functions/is not sufficient — the function must also be imported and added to thefunctionsarray, otherwise events will be silently dropped.
Adding a New Background Job
- Create your function file in
src/inngest/functions/your-function.tsusinginngest.createFunction(). - Export the function as a named export.
- Import it in
src/app/api/inngest/route.ts. - Add it to the
functionsarray insideserve(). - Dispatch events using
inngest.send()from your application code.