Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
notification_service
What it is
Serves Notifications across the product: a deployable service that composes
the notification domain crate into a running process. Exposes an HTTP API
for reading/unsubscribing from notifications, plus the Kafka-driven egress
worker that sends email/mobile-push/websocket notifications.
Start here
src/main.rs: composition root — wiresNotificationEgressService,NotificationWorker,NotificationEventsListener, and the outbound adapters (EmailAdapter,MobilePushAdapter,WebSocketGatewayAdapter,Kafka*RealtimePublisher,RedisRateLimitAdapter) fromcrates/notification.src/api.rs+src/api/context.rs: HTTP routes —user_notification.rs(list/read),unsubscribe.rs(single and atomic bulk item mute/snooze),health.rs.src/model/notification.rs: service-local request/response shapes.- Push payload schemas come from
notification::domain::models::apple; keep the frontend push validators generated from those same OpenAPI components. README.md: local DB setup (sqlx database setupfromcrates/notification_db_client).
Scope
- Owns: process wiring (config, adapters, HTTP routes) for notifications; the
domain logic (digesting, egress rules, send decisions) lives in
crates/notificationandcrates/notification_db_client. - Not here: notification domain logic itself →
crates/notification.
Recipes
- Add a notification HTTP route:
src/api/user_notification.rs(or a new module) →src/api.rs→src/api/swagger.rs. - Add a new egress channel: implement the port in
crates/notification(outbound/) → wire the adapter insrc/main.rs.
Checks
cargo test -p notification_service(SQLX_OFFLINEunset; needs local MacroDB —just run_dbs -d, thensqlx database setupfromcrates/notification_db_client).
Gotchas
PostgreSQL delete forwarding emits
notification.delete.publishspans and logs publication failures. The retention Lambda is a separate binary/role; seeservices/notification_retention_handlerand its rollout runbook.Don't log notification payloads on tracing spans (#7892) — they can carry sensitive content; log ids/types instead.
SES_CONFIGURATION_SETis optional. When set, every notification email is sent through that SES configuration set and taggednotification_type, so its event destination reports delivery, bounce, open and click per type. Set it only once the configuration set exists in that account and region and the stack's SES policy (which allowsconfiguration-set/*) is deployed.
Related
Skill:
new-serviceThe HTTP boundary validates optional signed agent correlation without changing existing authorization.