How to integrate EmailTemplate into an ERP
An ERP needs transactional templates (invoices, delivery notes, notices) to be stable, auditable and easy to update without deploying code. EmailTemplate fits as a template layer: the ERP calls the API to render, and delivery is handled by the ERP or the provider. This guide defines the architecture, the variable mapping and webhook handling with HMAC signatures.
How do I integrate an email template layer into an ERP step by step?
-
Integration model
Three pieces: a connector that talks to the API, on-demand rendering per business event, and a webhook receiver. The ERP never stores the final HTML, only the template ID.
textERP ──event (invoice, order)──▶ connector ──POST /render──▶ EmailTemplate │ │ │ ▼ │ HTML + subject + text │ │ ▼ ▼ send queue ◀──────────────────────────── ESP (Klaviyo / Mailchimp / Resend) ▲ └── webhooks (version.created) ──▶ refresh local template cache -
Template creation and versioning
Create templates once and version every change. The ERP always references the ID, not the HTML, so a change requires no deployment.
bashcurl -s -X POST https://api.emailtemplate.theboomer.dev/api/v1/templates \ -H "Content-Type: application/json" \ -H "x-api-key: $EMAIL_TEMPLATE_API_KEY" \ -d '{ "name": "Invoice notice", "subject": "Invoice {{ doc.id }}", "blocks": [], "html": "<!DOCTYPE html><html><body><h1>Hi {{ user.name }}</h1><p>Invoice {{ doc.id }}</p></body></html>" }' -
On-demand rendering
Pass the document variables (customer, number, amount) and receive the HTML. The API also returns the variables used, which is useful for auditing.
bashcurl -s -X POST https://api.emailtemplate.theboomer.dev/api/v1/templates/64f8a1b2c3d4e5f6a7b8c9d1/render \ -H "Content-Type: application/json" \ -H "x-api-key: $EMAIL_TEMPLATE_API_KEY" \ -d '{ "variables": { "user.name": "Ana", "doc.id": "INV-2026-0042" } }' -
Signed webhooks
Register one webhook per event and verify the signature. EmailTemplate retries with backoff (1m, 5m, 15m, 30m, 1h) and disables the webhook after repeated failures.
bashcurl -s -X POST https://api.emailtemplate.theboomer.dev/api/v1/webhooks \ -H "Content-Type: application/json" \ -H "x-api-key: $EMAIL_TEMPLATE_API_KEY" \ -d '{ "url": "https://erp.example.com/emailtemplate/webhook", "events": ["template.created", "template.updated", "version.created"] }' # Receiver verification (HMAC-SHA256, X-Signature header) expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest() if not hmac.compare_digest(received_signature, expected): reject() -
Idempotency and retries
Use an idempotency key per document and event (for example invoice:1234:notice). Store the ESP message-id and reuse it on retries so you never duplicate a send.
python# Connector pseudocode idempotency_key = f"{document_type}:{document_id}:{event}" if already_sent(idempotency_key): return result = render(template_id, variables) provider_message_id = send(result["html"], result["subject"], idempotency_key=idempotency_key) mark_sent(idempotency_key, provider_message_id) -
Observability
Log the template_id, versionId, render status and ESP message-id. The dashboard already shows history and usage; your ERP should be able to audit the same send.
textstruct LogEntry { string templateId; string versionId; // returned by /render and /export string event; // invoice, order, notice string documentId; int renderStatus; // 200, 400, 429... string providerMessageId; DateTime sentAt; }
| Item | Free | Pro | Team | Enterprise |
|---|---|---|---|---|
| Monthly price (EUR, VAT excluded) | €0 | €19 | €59 | €149 |
| Renders per month | 500 | 25,000 | 100,000 | 500,000 |
| Concurrent templates | 3 | 25 | Unlimited | Unlimited |
| Users | 1 | 2 | 10 | 25 |
| AI credits per month | 50 | 500 | 2,000 | 10,000 |
| AI operation cost | generate: 10 credits · suggest: 5 credits. Charged to the credit wallet (they do not consume renders) and the same on every plan. Packs: 500 credits / €9, 2,000 / €29, 5,000 / €69, 10,000 / €119. | |||
| Stack provider export | The ERP consumes HTML (text/html) over the API for its ESP. Per provider: format=klaviyo returns Liquid HTML, format=mailchimp returns JSON and format=resend returns React Email JSX. | |||
Subscription prices in USD/month; credit packs are charged in EUR. Product-published data, not estimates.
Frequently asked questions
How do I avoid duplicate sends?
Define an idempotency key per document and event, and store the message-id returned by the ESP. If the key already exists, do not resend.
Can I self-host EmailTemplate?
The Enterprise plan includes a self-hosted option. The API and webhooks work the same; only the base URL and where the data lives change.
Which webhook events exist?
template.created, template.updated, template.deleted and version.created. Register only what you need and always verify the HMAC signature.