Skip to content

Notifications & Templates

Account includes a full multi-channel transactional notification engine shared by your application code and sibling modules such as Payments, Commerce, and Packages.

Channel Key Transport / Storage Notes
email ProcessWire WireMail Localized subject, HTML body, and plain-text fallback.
sms Pluggable SMS driver (log default) Register custom gateways via $account->notifications()->registerSmsDriver().
webhook WireHttpTransport (SSRF-hardened) Signed with HMAC X-Account-Signature header; blocks private/loopback IP ranges.
in_app entries_tbl_account_inbox Persists per-user alerts queried via $account->inbox()->unreadCount() and markAllRead().

Custom channels and recipient resolvers can also be registered via registerChannel() and registerTargetResolver().

Account seeds 12 editable templates in account-templates on installation:

  1. security-otp-alert
  2. account-activity
  3. payment-receipt
  4. payment-refund
  5. payment-failed
  6. subscription-activated
  7. subscription-invoice-paid
  8. subscription-payment-failed
  9. subscription-canceled
  10. order-confirmation
  11. commerce-abandoned-cart
  12. system-health-alert
Every starter template supports multi-language overrides, channel selection, and optional ConditionRuleEvaluator predicates.
<?php namespace ProcessWire;
$account = Account::requireInstance($wire);
$notifications = $account->notifications();
// Render subject and body without dispatching
$preview = $notifications->preview('payment-receipt', [
'locale' => 'en',
'data' => ['reference' => 'CHR-2026-104', 'amount' => 'EUR 4,900.00'],
]);
// Respect global dispatch mode (sync or queued via SendNotificationQueue)
$notifications->send('account-activity', [
'user' => $user,
'email' => $user->email,
'data' => ['member_name' => 'Claire Beaumont', 'activity' => 'Berth confirmed'],
]);
// Force immediate synchronous dispatch or explicit background queue
$notifications->sendNow('security-otp-alert', ['email' => $user->email, 'data' => ['code' => '482910']]);
$notifications->queue('order-confirmation', ['user' => $user, 'data' => ['order_no' => 'AV-9012']]);

Templates can attach declarative ConditionRuleEvaluator rules so a channel only fires when runtime payload fields match (for example, sending an SMS alert only when amount_minor >= 500000).

Every dispatch writes a structured record into entries_tbl_account_deliveries for troubleshooting and retention pruning.
<?php namespace ProcessWire;
// Read and clear a member's in-app inbox
$unread = $account->inbox()->unreadCount((int) $user->id);
$account->inbox()->markAllRead((int) $user->id);
// Deterministic test fake (zero external emails, SMS, or webhooks sent)
$account->fakeNotifications();
// ... run application code under test ...
$account->assertNotificationSent('account-activity', fn (array $record): bool => $record['channel'] === 'email');
$recorded = $account->recordedNotifications();
$account->clearNotificationFake();

Next steps