Kauri Bay CRM replacement

Template management specification

A controlled way for authorised staff to create, amend, test, publish, version, and roll back operational email templates without editing workflow logic or source code.

Status
Ready for review
Scope
Weddings and Events email
Version
1.0 draft, SPEC-010

Purpose and boundaries

The replacement CRM must let authorised staff manage reusable operational email templates without editing workflow logic or source code. Templates own content and sender configuration. Workflows own triggers, timing, recipients, stage changes, tasks, and manual overrides.

In scope

Out of scope for first release

Design principles

  1. Published versions are immutable and every workflow action references a specific version.
  2. No production send occurs without a resolved recipient, approved sender, and rendered content.
  3. A template edit cannot silently change a live workflow.
  4. All material changes are attributable, timestamped, auditable, and reversible.
  5. Raw imported source content is retained separately from transformed content.
Requires approval before build

Required capabilities

Version and publishing rules

  1. Drafts are editable by authorised template managers.
  2. A published version is immutable.
  3. Editing a published template creates a new draft version.
  4. Only one version may be active for a workflow action at a time.
  5. A referenced template cannot be disabled without an explicit replacement or pause decision.
  6. Every published version records its approver, publication time, sender, subject, body, merge fields, and workflow references.

Permissions

RoleViewDraftsTestPublishDisable / rollback
Operational userAssigned templatesNoNoNoNo
Template managerAll operational templatesCreate and editYesNoNo
Product owner / approverAll operational templatesOptionalYesYesYes
System administratorAllYesYesOnly when authorisedYes, audited

Users may not approve their own changes under normal permissions. Test sends are restricted to approved internal recipients, and sender identities are separately permissioned.

Lifecycle

StateMeaningAllowed transition
DraftEditable and not used by live workflowsSubmit or discard
In reviewFrozen for approvalReturn to draft or approve
ApprovedReady to publishPublish or return to draft
PublishedImmutable and available to workflow actionsSupersede, disable, or retire
DisabledNot selectable for new bindings or sendsRestore or retire
RetiredHistorical and audit-onlyNone

Content and merge fields

Each version stores name, purpose, pipeline, owner, subject, HTML body, plain-text body, sender, reply-to, preview text, merge-field manifest, checksum, source reference, and publication metadata.

First-release merge fields are limited to contact first and last name, email address, deal name, pipeline, stage, owner name, close date, quote expiry date, approved organisation name, current New Zealand date, template name, and workflow name.

Required missing values block preview, approval, and send. Optional values use an approved fallback. Raw HubSpot property names are not exposed in the editor.

Authoring, preview, and test send

Workflow linkage

Each workflow email action references a template version, sender identity, recipient rule, timing and timezone, missing-data policy, and failure policy. The workflow view shows the binding and the template screen shows every workflow using it.

Sending uses Microsoft Graph. The service validates recipient, consent, suppression, sender permissions, and required fields; renders HTML and plain text; records an idempotency key; retries bounded transient failures; and routes permanent failures to an operator-visible exception queue.

Known source fixture
HubSpot email Final Email Follow up | Kauri Bay Boomrock, email ID 133908258823, subject Final Email Follow Up, from Danica Griggs at events@kauribayboomrock.co.nz. It is a candidate source template, not an approved replacement version. HubSpot currently shows it attached to zero simple workflows.

Minimum data model

The first release requires records for email_template, email_template_version, workflow_template_binding, template_test_send, email_delivery, and template_audit_event.

These records must retain immutable content checksums, lifecycle state, actor, timestamps, source references, workflow bindings, sender identity, recipient rule, provider message ID, idempotency key, delivery outcome, and safe error details.

Security and operations

Delivery sequence

  1. Approve this specification, role matrix, and Microsoft Graph sender boundaries.
  2. Add template entities and audit migrations.
  3. Build catalog, authoring, rendering, test-send, approval, binding, and Graph services.
  4. Import the Final Email fixture as a draft and confirm mapping, recipient, timing, and sender.
  5. Run acceptance tests, migration rehearsal, controlled test send, rollback test, and cutover evidence.

Acceptance tests

Approval required from Oliver Ormond as project approver and product owner. Technical owner: Stuart Gordon.