Brevo API Integration
Event-driven Brevo contact sync and transactional email inside a WordPress application workflow.
Messaging tied to application state
A payment and application platform needed Brevo contact updates and transactional email tied to existing form and payment events. The integration had to keep one contact record, choose the right template and support a document link or attachment. Staff also needed a manual resend path when a message had to be sent again.
The event is the source of truth. Email is a downstream effect.
Constraints that shaped the design
Event driven. Messages follow form and payment state changes.
One contact record. Each applicant maps to one Brevo contact.
Template controlled. Copy lives in Brevo templates.
Attachments. Some messages include a generated PDF.
WordPress events to Brevo delivery
Form event → Payment event → Mapper → Brevo API → Template → Admin. Form and payment hooks map the applicant, update the Brevo contact and choose the template. The send result is recorded for staff, and a resend can be triggered from the entry screen.
Three messaging paths
Submission received
- 01Applicant submits a form.
- 02The integration maps email and name.
- 03Brevo creates or updates the contact.
- 04The lifecycle attribute changes to submitted.
- 05The confirmation template is sent.
Delivery retry
- 01A Brevo request returns an error.
- 02The send path records the failure on the application entry.
- 03The application record remains available.
- 04An administrator can resend from the entry screen.
- 05The contact lifecycle flag remains independent of the send attempt.
Payment completed twice
- 01The same applicant submits another form.
- 02The email matches an existing Brevo contact.
- 03The contact is updated instead of duplicated.
- 04The lifecycle attributes retain the latest state.
- 05No second contact record is created.
Evaluated options and trade-offs
Trigger model
A) Poll Brevo
B) Push on WordPress events
Push on WordPress events
ARCHITECTUREForm and payment hooks already know when the state changed.
Delivery failures need their own retry path.
Contact model
A) Local list only
B) Brevo contact sync
Brevo contact sync
CRMThe team needed lifecycle segments and a single contact record.
Contact fields must stay mapped.
Message content
A) Hard-coded HTML
B) Brevo templates
Brevo templates
CONTENTTemplates let the team change copy without a plugin release.
Template IDs and variables become configuration.
Integration boundaries
Stored in site settings
No key in the browser
Admin resend requires entry edit permission
Resend requests are validated
Email is the match key
Sends leave an operational record
What the integration delivers
- Contacts are created or updated from form state.
- SUBMITTED and PURCHASED flags track lifecycle state.
- Templates are chosen per form or feed.
- PDF links or attachments support document delivery.
- Staff can resend a message from the entry screen.
- Add a durable delivery log with retry status.
- Move scheduled sends to a queue with visibility.
- Add contract tests for template variables.
Transferable engineering principles
Treat email as a side effect of a domain event.
Keep message copy in the tool that owns it.
Continue reading
Next Case Study → Cross-Domain Payment Proxy Architecture
A reusable cross-site payment bridge with signed server-to-server calls and tokenized capture.
Need a system architected like this?
Available for architecture advisory, custom PHP payment gateway bridges and resilient distributed workflows.