Notifications

Notifications let you attach operational messaging to collection routes. They are configured per mutation route and are evaluated when the relevant event happens during the lifecycle of that route or its approval flow.

Event Triggers

Supported events include:

  • ON_SUCCESS
  • ON_ERROR
  • ON_AR_CREATED
  • ON_AR_UPDATED
  • ON_AR_DELETED
  • ON_AR_APPROVED
  • ON_AR_REJECTED
  • ON_AR_CHANGE_REQUESTED
  • ON_AR_PATH_CHANGE

Notification Templates

A notification config contains one or more templates. Each template decides:

  • who should receive the message,
  • what the subject should be,
  • what the message body should contain,
  • whether email should also be sent.

1. Audience Matrix (AUDIENCE_MATRIX)

The audience codeblock decides who receives the notification. It returns three buckets of email addresses: to, cc, and bcc.

import { Params, ReturnType } from './data';

export function run(params: Params): ReturnType {
	if (params.scope.event_data?.type === 'ON_AR_APPROVED') {
		return {
			to: ['finance@example.com'],
			cc: ['requester@example.com'],
			bcc: []
		};
	}

	return {
		to: [],
		cc: [],
		bcc: []
	};
}

Returning empty arrays is the normal way to skip delivery for a particular event or context.

2. Message Subject (CEL)

Use CEL for concise subjects based on the route context, such as:

  • "Project " + data.record.name + " updated"
  • "Invoice " + data.record.invoice_number + " requires review"

3. Message Template (MESSAGE_TEMPLATE)

Use a TypeScript codeblock when the body needs richer formatting or when the content should vary by event type.

Subject CEL is simpler than the body template
The subject expression does not currently receive event_data the same way the audience and message template codeblocks do. Put event-specific branching in the body codeblock when needed.

Delivery

Notifications create in-app messages for to recipients. If email sending is enabled for the template, the same notification can also be delivered via email.

Use cc and bcc for email distribution, but do not assume those buckets create their own in-app inbox entries.

  • Branch on event_data.type inside the audience or message template codeblock.
  • Return email buckets rather than user IDs or team IDs.
  • Use CEL subjects for short, stable phrasing.
  • Keep noisy operational chatter out of notifications unless someone must act on it.