๐Ÿ“ง

Harry CRM โ€” SE โ†’ Resend Migration

Project Plan ยท LMP Consulting s.r.o. ยท 2026-03-23

๐ŸŸก Planning โ† Stack Info
14
Files Affected
~4,000
Lines of SE Code
~1,250
Lines New/Modified
~1,071
Lines Deleted
6
Migration Phases
54
Resend Docs Files

๐Ÿ‘ฅ Team Assignments

๐Ÿพ
Koda
Project Lead
Plan, coordination, approvals
โœ“ Done
โš™๏ธ
Nexus
Migration Architect
Technical design, execution
โœ“ Done
๐ŸŒŸ
Atlas
Documentation
Resend + SE + Harry CRM docs
โœ“ Done
๐ŸŽฏ
Catalyst
Customer Advocate
Capability comparison, features
โœ“ Done

๐Ÿš€ Why Resend Over SmartEmailing

CapabilitySmartEmailingResend
API Designv3 REST, Czech docs, quirkyModern REST, excellent docs, OpenAPI
AuthenticationHTTP Basic (user + key)Bearer token (single key)
Transactional EmailRequires SE template IDSend raw HTML directly
Stats TrackingPolling (hourly)Webhook-driven (real-time)
Inbound EmailโŒ Not supportedโœ… Full receiving API
MCP ServerโŒ Not availableโœ… Official npm package
Broadcasts APICampaigns onlyโœ… Dedicated API
Subscription TopicsโŒ Not availableโœ… Granular opt-in/out
Dynamic SegmentsStatic contact listsโœ… Rule-based segments
Email SchedulingCustom code neededโœ… Native scheduling
Batch SendWorkaround APIโœ… Up to 100 per call
Domain Mgmt APIโŒ Manualโœ… Full API (create, verify)
Contact PropertiesLimited custom fieldsโœ… Full properties API

๐Ÿ—๏ธ Target Architecture

Campaign Engine
Automated flows
โ†’
resend_client.py
REST API Client
โ†’
Resend Platform
Shared API key
AI Assistant
Ad-hoc, conversational
โ†’
Resend MCP Server
npx resend-mcp
โ†’
Resend Platform
Same API key

Two integration paths: REST client for automated campaigns, MCP server for AI-driven ad-hoc emails. Shared API key, domain, and webhooks.

๐Ÿ“‚ Files Changed

ActionFileDescription
CREATEresend_client.pyAsync Resend API client (~400 lines)
CREATEresend_webhooks.pyWebhook parser with svix verification
CREATEschemas/resend.pyPydantic request/response models
CREATEAlembic migrationNew columns + enum values
MODIFYcampaign_service.py_send_via_resend() replaces SE
REWRITEstats_sync_service.pyPoller โ†’ webhook-driven reconciler
MODIFYagent_service.pyTool descriptions, campaign flow
MODIFYapi/webhooks.pyAdd Resend webhook route
MODIFYapi/integrations.pyResend auth flow
MODIFYmodels/*.pyProvider enum, campaign columns
MINORfrontend/settingsResend integration UI
DELETEsmartemailing_client.py719 lines removed
DELETEsmartemailing_webhooks.py168 lines removed
DELETEsmartemailing_service.py~100 lines (already deprecated)
DELETEschemas/smartemailing.py84 lines removed

๐Ÿ“‹ Migration Phases

1๏ธโƒฃ

Foundation

  • โ€ข Create resend_client.py
  • โ€ข Create schemas/resend.py
  • โ€ข Webhook parser with svix
  • โ€ข Provider enum + config
  • โ€ข MCP Server setup
  • โ€ข Unit tests
~600 lines new code
2๏ธโƒฃ

Campaign Swap

  • โ€ข _send_via_resend()
  • โ€ข Batch sending (100/call)
  • โ€ข Template variable mapping
  • โ€ข Fix targeting bug
  • โ€ข Broadcast ID tracking
~300 lines modified
3๏ธโƒฃ

Webhooks & Stats

  • โ€ข Resend webhook route
  • โ€ข Event mapping (6 types)
  • โ€ข Stats โ†’ webhook-driven
  • โ€ข Auto-register webhook URL
  • โ€ข svix signature verification
~250 lines
4๏ธโƒฃ

AI Agent Update

  • โ€ข Update Slovak tool descriptions
  • โ€ข Remove SE-specific fields
  • โ€ข Connect MCP for ad-hoc
  • โ€ข Full E2E AI flow test
~200 lines modified
5๏ธโƒฃ

Frontend & Upsell

  • โ€ข Resend settings UI
  • โ€ข Upsell opportunity toggle
  • โ€ข Upsell notes field
  • โ€ข Filter by upsell flag
  • โ€ข Dashboard widget
~200 lines
6๏ธโƒฃ

Cleanup & Testing

  • โ€ข Delete 4 SE files
  • โ€ข DB migration script
  • โ€ข Unit + integration tests
  • โ€ข E2E AI campaign test
  • โ€ข SE reference grep
~300 lines tests

๐Ÿ”ง Tech Debt Fixed During Migration

IssueSeverityFix
hmac.new() bug in webhook handler๐Ÿ”ด HighReplaced by svix verification
API key "encryption" is just base64๐ŸŸก MediumUse env-only or proper encryption
/docs endpoint open in production๐ŸŸก MediumDisable in prod config
Debug print() in SE client๐ŸŸข LowRemoved with SE client deletion
_get_targeted_customers() sends to ALL๐Ÿ”ด HighFix targeting logic in Phase 2

โ“ Decisions for Caly

#QuestionRecommendation
1Which domain to verify in Resend?Client domain (prod) + lmp-ai.net (dev)
2Contact sync strategyHarry DB = source of truth (no sync)
3Transition approachHard cut (no dual-provider)
4Bulk send methodBatch Send (Harry controls targeting)
5API key storage.env only (simpler, more secure)
6Upsell marking designBoolean flag + notes text field
7Parallel periodNone (hard cut after testing)

โš ๏ธ Risk Assessment

RiskLikelihoodImpactMitigation
Rate limits during bulk sendsMediumCampaign delaysBatch with exponential backoff
Webhook delivery gapsLowMissed statssvix retry + manual sync fallback
Template variable mismatchLowBroken emailsTest with real campaign data
Agent prompt driftMediumWrong tool callsCareful Slovak rewrite + testing
Domain verification delaysLowCan't sendStart immediately, use test domain

๐Ÿ“… Estimated Timeline

Phase 1-2
Sessions 1-3
โ†’
Phase 3-4
Sessions 3-4
โ†’
Phase 5-6
Sessions 5-6
โ†’
Go Live
After Approval

Total: ~6 sessions (can be parallelized to 3-4). No code changes until Caly approves.

๐Ÿ“š Documentation Index

๐Ÿ“ intro/4 files
๐Ÿ“ emails/12 files
๐Ÿ“ contacts/6 files
๐Ÿ“ domains/7 files
๐Ÿ“ api-keys/3 files
๐Ÿ“ webhooks/4 files
๐Ÿ“ broadcasts/6 files
๐Ÿ“ templates/5 files
๐Ÿ“ audiences/4 files
๐Ÿ“ segments/Atlas
๐Ÿ“ topics/Atlas
๐Ÿ“ dashboard/Atlas
๐Ÿ“„ mcp-server.mdMCP Guide
๐Ÿ“„ openclaw-guide.mdAgent Inbox
๐Ÿ“„ MIGRATION-PLAN.mdKoda