Welcome Email Plan (Brevo API)
Plan to send a modern welcome email to new merchant installs using Brevo API.
Welcome Email Plan (Brevo API)
Section titled “Welcome Email Plan (Brevo API)”1) Current Status (Confirmed)
Section titled “1) Current Status (Confirmed)”Brevo API is now implemented for uninstall flow:
app/lib/email.server.jsuses Brevo transactional API env vars.sendGoodbyeEmail()is implemented and production-safe (returns{ ok, error }).sendLowBalanceAlert()is currently a stub (console only).
Decision update: welcome and uninstall email flows are both on Brevo API.
Implementation status update:
- Done:
sendWelcomeEmail()is implemented and called fromafterAuthwith idempotency (welcome_email_sent). - Done:
sendGoodbyeEmail()is implemented and wired to uninstall webhook updates. - Done:
.env/.env.sampleuse Brevo variables (BREVO_*) only. - Pending per environment: run
npx prisma migrate deployto ensureshopsemail flag columns exist everywhere.
2) Goal
Section titled “2) Goal”Send a welcome email to merchants when they install/sign up successfully, with:
- modern visual style
- strong readability
- good font stack (email-safe first, web font optional)
- clear CTA to open app settings
- optional onboarding checklist
3) Trigger Strategy
Section titled “3) Trigger Strategy”Recommended trigger point: afterAuth in app/shopify.server.js.
Why:
- runs on successful OAuth
- has merchant identity context (
shopDomain,shopName,shopEmail) - closest point to “signup/install success”
Important: prevent duplicate sends.
Idempotency approach (Shop fields only)
Section titled “Idempotency approach (Shop fields only)”Do not create a new table. Use boolean flags on Shop:
welcome_email_sent(defaultfalse)uninstall_email_sent(defaultfalse)
Optional companion fields for debugging/retry visibility:
welcome_email_sent_at(nullable DateTime)welcome_email_error(nullable text)uninstall_email_sent_at(nullable DateTime)uninstall_email_error(nullable text)
Minimum requirement from this plan:
- Use booleans as source of truth (
true= already sent; skip duplicate send).
4) Env and Config
Section titled “4) Env and Config”Add Brevo env vars:
BREVO_API_KEY(secret; keep only in.env, never commit real value in docs/repo)BREVO_FROM_EMAILBREVO_FROM_NAME
Optional:
-
BREVO_REPLY_TO_EMAIL -
BREVO_REPLY_TO_NAME -
WELCOME_EMAIL_ENABLED=true(feature flag) -
WELCOME_EMAIL_REPLY_TO=support@appifire.com
5) Template Spec (Modern Style)
Section titled “5) Template Spec (Modern Style)”Use multipart email:
- plain text fallback
- HTML template
Typography
Section titled “Typography”Primary stack (safe):
'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif
Notes:
- Many clients ignore custom web fonts; keep robust fallback stack.
- Design for email client constraints (inline styles, table-based layout where needed).
Visual style
Section titled “Visual style”- Background: very light gray
#F6F8FB - Card container: white, rounded corners
- Accent brand color: use app primary (e.g.
#5C6AC4) - Headline: bold, friendly
- Body copy: 15-16px equivalent, high contrast
- CTA button: solid brand color, large touch target
Suggested sections
Section titled “Suggested sections”- Greeting (
Hi {shopName}) - One-line value proposition
- Quick start checklist (3 bullets)
- CTA: “Open App Settings”
- Support line + reply-to
- Footer (you received this because…)
6) Example Email Content
Section titled “6) Example Email Content”Subject
Section titled “Subject”Welcome to AppiFire AI Chat - Let's get your store live
Preview text
Section titled “Preview text”You're set up. Add your first settings in under 2 minutes.
Body copy
Section titled “Body copy”- “Thanks for installing AppiFire AI Chat.”
- “Your storefront assistant is ready - now let’s personalize it.”
- Checklist:
- Set welcome message
- Choose widget style/colors
- Test first customer question
CTA link target:
${SHOPIFY_APP_URL}/app/settings (or your real settings route)
7) Implementation Tasks
Section titled “7) Implementation Tasks”- Add
sendWelcomeEmail()toapp/lib/email.server.js(orapp/lib/brevo.server.js) - Implement Brevo API client call (
POST https://api.brevo.com/v3/smtp/email) - Add HTML builder + plain text builder
- Add idempotency fields on
Shop(no new table):welcome_email_sentuninstall_email_sent
- In
afterAuth, send only if:- email exists
- feature flag enabled (if used)
welcome_email_sent !== true
- Persist send success/failure state on
Shop:- success: set
welcome_email_sent = true - failure: keep
falseand store error message (optional)
- success: set
- Log with shop domain + reason on failure
8) Failure Handling
Section titled “8) Failure Handling”- Never fail OAuth/install because email fails.
- Send email async or fire-and-forget after core install path.
- Capture errors for later retry:
- “Brevo API key not configured”
- 401/403 from Brevo API
- 429 rate limit
- timeout/network
9) QA Checklist
Section titled “9) QA Checklist”- New install with valid shop email -> welcome email arrives
- Re-auth/login of same merchant -> no duplicate welcome email
- Missing email -> no send, graceful log
- Brevo key missing/invalid -> no crash, error captured
- Email renders correctly on:
- Gmail web/mobile
- Outlook web
- Apple Mail
10) Rollout
Section titled “10) Rollout”- Enable in staging/test store first
- Verify template rendering and CTA route
- Enable in production
- Monitor:
- send success rate
- bounces/complaints
- open/click (if tracking added later)