Documentation
¶
Overview ¶
Package template renders Notify templates and manages the lifecycle.
Lifecycle: draft → pending_approval → approved → published → archived. Only `published` templates can be invoked from a SendRequest. The approval transition (pending_approval → approved) requires a privileged caller (X-Roles claim contains "notify-approver").
Rendering uses Go's text/template with a small custom function map. The library is text/template (not html/template) because notify payloads include SMS and voice scripts that have no HTML semantics; callers sending email templates with HTML are responsible for escaping their inputs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadPublished ¶
LoadPublished fetches the latest published version of (tenant, name). When channel is non-empty, a channel-scoped row is preferred and the channel-agnostic fallback only fires if no channel match exists. This keeps a tenant from having to maintain disjoint template names per channel — one name + one row per (channel) is enough.
Returns a "not found" error when no row matches; the routes layer maps that to HTTP 400.