notifications

Device and browser subscriptions, per-category preferences, and a fan-out other modules call.

With fz, into the venture manifest

fz add notifications

With cargo

cargo add cratefield-module-notifications

fz runs inside your venture repository, linked against its own harness. About fz

What it is

notifications.

A subscription is a device or browser endpoint; a preference is per account and per category. Other modules do not talk to a push vendor: they call this module's fan-out and it delivers through the Push port, so APNs, FCM and Web Push are adapters rather than a dependency of whoever wanted to send something. Delivery is drained rather than attempted inline, so a slow vendor does not become a slow request.

Ports

Database · Push · Clock · IdGen

Routes

/v1/notifications

  • GET/v1/notifications/

    The reader's notifications

  • GET/v1/notifications/unread-count

    The badge number

  • POST/v1/notifications/read-all

    Mark everything read

  • GETPUT/v1/notifications/preferences

    Per-category preferences

  • POST/v1/notifications/subscriptions

    Register a device or browser

  • DELETE/v1/notifications/subscriptions/{id}

    Remove one

  • POST/v1/notifications/email/webhook

    Delivery events from the mail vendor

Before you compose it

Published and composable by hand today, but fz build cannot yet select it: the manifest's built-in catalogue lags the curated list (harness #451). Compose it directly in your venture until that lands.

History

Changelog.

From the crate’s CHANGELOG.md in the harness, as of 0c5560b. 5 versions recorded, newest first. Every published version is on crates.io.

  1. 0.3.3

    crates.ioReleaseDiff

    Other

    • updated the following local packages: cratefield-core, cratefield-mail-templates, cratefield-auth-client
  2. 0.3.2

    crates.ioReleaseDiff

    Other

    • adapter-telegram + module-telegram: verified bot webhook, account linking, rate-limited messages, signed action buttons and a notifications channel (#764) (#864)

    Added

    • a Channel trait for extra delivery channels a venture registers with .channel(..), such as Telegram: one outbox row per registered channel on the notifications.channel topic, with the push adapters' error shapes (#764)
3 earlier versions 0.2.1 to 0.3.1
  1. 0.3.1

    crates.ioReleaseDiff

    Fixed

    • close five input-validation gaps — an unescaped HTML sink, a javascript: URL, an unvalidated slug, an OAuth token sent to any host, and an unclamped page size (#826)
    • GET /v1/notifications?limit=0 no longer returns an empty inbox. The page size is clamped to 1..=INBOX_PAGE_MAX (the idiom module-orgs and module-crm already use) instead of only capped from above, so a zero limit is the default page rather than a page that looks full and hands back a next cursor for a page that cannot exist. A limit above the ceiling still clamps to INBOX_PAGE_MAX.
  2. 0.3.0

    crates.ioReleaseDiff

    Added

    • mail-templates branded mail in each venture's own style for every module that sends mail (#715) (#716)

    Changed

    • Breaking: requires cratefield-core 0.8 (was 0.7), and so a minor rather than a patch bump: a venture still on core 0.7 does not pick this release up through a caret requirement and end up with two copies of core (#712).
    • The notification email renders through the template registry as notifications/email, in the venture's theme via cratefield-mail-templates, so a venture can restyle or reword it. default_templates() and themed_templates(&theme) are new; subject selection, lang/dir, Content-Language and the one-click unsubscribe headers are unchanged (#715).
  3. 0.2.1

    crates.ioRelease

    Other

    • updated the following local packages: cratefield-core

One fan-out, three push vendors behind a port.