Skip to content

feat: Widget → CRM events via EventBus (#620)#629

Merged
ShaerWare merged 3 commits intomainfrom
server/eventbus-widget-crm
Mar 20, 2026
Merged

feat: Widget → CRM events via EventBus (#620)#629
ShaerWare merged 3 commits intomainfrom
server/eventbus-widget-crm

Conversation

@ShaerWare
Copy link
Owner

Summary

  • Extract all amoCRM integration logic (~150 lines) from widget/router_public.py into dedicated CRM domain event handlers in modules/crm/startup.py
  • Widget router now publishes 3 typed domain events (WidgetSessionCreated, WidgetMessageSent, WidgetContactSubmitted) instead of calling amoCRM API directly
  • CRM domain subscribes to events and handles lead creation, note appending, and contact linking independently
  • 7 unit tests covering all handler paths (create lead, skip when disabled, skip when no config, add note, create contact + link, create contact + new lead, event fields)

Test plan

  • All 7 new tests pass (pytest tests/unit/test_widget_crm_events.py)
  • All 87 unit tests pass (no regressions)
  • CI checks (lint-backend, lint-frontend, security)

Closes #620

🤖 Generated with Claude Code

ShaerWare and others added 3 commits March 20, 2026 12:27
…620)

Extract all amoCRM integration logic from widget router into CRM domain
event handlers. Widget now publishes domain events; CRM subscribes and
reacts independently.

New files:
- modules/channels/widget/events.py — 3 widget domain events
- modules/crm/startup.py — CRM event handlers (lead/contact/note)
- tests/unit/test_widget_crm_events.py — 7 unit tests

Changed:
- modules/channels/widget/router_public.py — removed ~150 lines of CRM
  logic, now publishes WidgetSessionCreated, WidgetMessageSent,
  WidgetContactSubmitted events
- modules/core/startup.py — wires CRM event subscriptions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ShaerWare ShaerWare merged commit 70b40bd into main Mar 20, 2026
3 checks passed
@ShaerWare ShaerWare deleted the server/eventbus-widget-crm branch March 20, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 5.4: Widget → CRM events (SessionCreated, MessageSent, ContactSubmitted)

2 participants