Documentation menu

Action templates

Which templates are ready, which are reference skeletons, and when each one makes sense.

Not every template serves the same purpose.

This catalog splits them into:

  • Ready starting points — realistic defaults, worth trying first
  • Reference patterns — useful integration scaffolds that still need project-specific wiring

Ready starting points

TemplateTriggerUse it when...Notes
hello-worldEVENT:user.human.addedyou want to verify a trigger and inspect payload shapesafest first step
auto-group-by-departmentEVENT:user.human.addedyou want first-time onboarding into Atrium groups (login-time mirroring already runs in flatten-roles)one-time lifecycle action
prefill-from-entraEVENT:user.human.addedyou want default app access for newly created Entra-backed usersadjust project/role constants
flatten-rolesFUNCTION:preuserinfoyou need v1 flatRoles parity on userinfo / ID-token-adjacent flowscanonical claim migration template
flatten-roles-access-tokenFUNCTION:preaccesstokenthe same claims must exist in the access tokentwin of flatten-roles for access-token consumers

Reference patterns

TemplateTriggerWhat it demonstrates
welcome-emailEVENT:user.human.addedtransactional email via ctx.fetch + secrets
scim-fanout-on-grantEVENT:user.grant.addeddownstream provisioning through Atrium's SCIM sync path
sentry-grant-fanoutEVENT:user.grant.addednon-SCIM SaaS provisioning via REST API
dokploy-grant-fanoutEVENT:user.grant.addedcustom grant fan-out to a non-SCIM API
slack-notify-on-grantEVENT:user.grant.addedlightweight audit notifications

Treat these as integration patterns, not drop-in business logic.

Department → Atrium-group mapping

In this deployment, mirroring a user's Zitadel department metadata into the matching Atrium group runs as a side-effect of the flatten-roles action (FUNCTION:preuserinfo) — it fires on every userinfo call, so login-time catch-up is already covered.

The auto-group-by-department template (EVENT:user.human.added) is the companion that closes the first-login gap: it places the user in the group at account creation time, so the very first SAML sign-in already sees the membership. Activate this one when sign-in-time provisioning (e.g. sentry-team-sync) needs the group to exist before the user has touched userinfo.

The previous auto-group-by-department-on-login template (EVENT:oidc_session.added) was removed in 2026-06: it overlapped with the flatten-roles side-effect and created two writers for the same data, which made group descriptions point at the wrong owner.

The flatRoles pair

These are the most important OMMAX-specific templates now.

flatten-roles

Use when the consuming app reads claims from:

  • userinfo
  • ID-token-adjacent flows
  • a path backed by preuserinfo

flatten-roles-access-token

Use when the consuming app reads claims from:

  • the access token

Often the correct migration is:

  • activate both
  • keep the logic aligned
  • let each Function slot serve its own surface

The slot rule

Atrium only routes one ACTIVE script per exact trigger slot.

That means:

  • one ACTIVE FUNCTION:preuserinfo
  • one ACTIVE FUNCTION:preaccesstoken
  • one ACTIVE EVENT:user.human.added

So if you need multiple behaviours in one live slot, combine them into one script instead of trying to stack multiple active scripts.

How to choose quickly

  1. Need claims? Start with flatten-roles / flatten-roles-access-token.
  2. Need lifecycle automation? Start with auto-group-by-department or prefill-from-entra.
  3. Need to explore payload shape first? Start with hello-world.
  4. Need third-party provisioning? Use one of the reference fan-out templates and customize it.