Shared DTOs on both sides with identical JSON keys, the service API constants with the access convention (the service enforces company, owner and admin), Snowflake ids as strings towards the portal, and the counter's WhatsApp contact type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
6.7 KiB
6.7 KiB
Tasks: add-whatsapp-inbox
Design: design.md and docs/superpowers/specs/2026-12-02-whatsapp-inbox-design.md. Every task is TDD, followed by the review gate (an Opus reviewer). At most 2 workers run at once (owner, 2026-12-01). Waves list tasks that may run in parallel in separate worktrees. Everything else runs serially in order.
Verify commands:
- Backend:
mvn -T 1C -q -pl <modules> verify(-T 0.5Cwhile a wave builds at the same time). - Portal:
cd solvway-admin-portal && npx vitest run; echo VITEST=$? && npx tsc --noEmit && npm run lint(check the vitest exit code).
Wave 1 (serial: contracts and hotspots)
- 1.1 Schema and modules:
sql/01-whatsapp-schema.sql,sql/02-whatsapp-modules.sqlandsql/99-rollback.sqlin this change folder, mirrored intolocal/seed/.- Depends on: none
- Scope:
openspec/changes/add-whatsapp-inbox/sql/**,local/seed/** - Verify: load the seed into a fresh local MySQL volume (compose
down -von a throwaway project name, thenup mysql) and list the tables.
- 1.2 Service skeleton:
solvway-services-whatsappmodule (pom, Dockerfile,application.yml, settings binding, health), root pom module entry, the gateway routePath=/whatsapp/**, and compose entries for the service andwhatsapp-mock. The mock is a skeleton that answers health.- Depends on: 1.1
- Scope:
solvway-services-whatsapp/**,pom.xml,solvway-api-gateway/src/main/resources/application.yml,local/docker-compose.yml,local/whatsapp-mock/**,local/.env.example - Verify:
mvn -T 1C -q -pl solvway-services-whatsapp,solvway-api-gateway verify
- 1.3 Shared DTOs and API constants: the webhook ingest body, conversation and message views, and
RestApiWhatsappServiceConstantsin mobile-api.- Depends on: 1.2
- Scope:
solvway-services-whatsapp/src/main/java/**/dto/**,solvway-mobile-api/src/main/java/**/constant/api/RestApiWhatsappServiceConstants.java,solvway-mobile-api/src/main/java/**/dto/whatsapp/** - Verify:
mvn -T 1C -q -pl solvway-services-whatsapp,solvway-mobile-api verify
Wave 2 (parallel: 2.1 and 2.2)
- 2.1 Service ingest:
- number-to-company routing restricted to the matched companies;
- conversation upsert and the message insert, idempotent on
wamid; - the status ranking;
last_inbound_at.- Depends on: 1.3
- Scope:
solvway-services-whatsapp/src/main/java/**exceptmeta/**anddto/**,solvway-services-whatsapp/src/test/** - Verify:
mvn -T 0.5C -q -pl solvway-services-whatsapp verify
- 2.2 Counter lead lookup:
GET /counter/lead/whatsappContact(newest lead by mobile, its latest salesperson), and the best-effortleadChangednotify on the event lead save paths (capture, salesperson change).- Depends on: 1.3
- Scope:
solvway-services-counter/** - Verify:
mvn -T 0.5C -q -pl solvway-services-counter verify
Wave 3 (parallel: 3.1 and 3.2)
- 3.1 mobile-api webhook: the GET handshake, the POST raw-body HMAC against each company secret, forwarding to ingest, the per-IP limit, the public-route exemptions, and
LogRedactormasking for the webhook query.- Depends on: 2.1
- Scope:
solvway-mobile-api/src/main/java/**/whatsapp/**,solvway-mobile-api/src/main/java/**/controller/PublicWhatsApp*,solvway-mobile-api/src/test/**/whatsapp/**,solvway-api-gateway/src/main/java/**/LogRedactor.java,solvway-api-gateway/src/test/**/LogRedactorTest.java, and the public-path exemption config (security code: also read the whole diff in the controller check) - Verify:
mvn -T 0.5C -q -pl solvway-mobile-api,solvway-api-gateway verify
- 3.2 Service ownership:
OwnershipService.recompute, the user access check, theleadChangedanduserChangedendpoints, manual assign and automatic return, and the nightly job.- Depends on: 2.1, 2.2
- Scope:
solvway-services-whatsapp/src/main/java/**/ownership/**,solvway-services-whatsapp/src/main/java/**/job/**,solvway-services-whatsapp/src/test/**/ownership/** - Verify:
mvn -T 0.5C -q -pl solvway-services-whatsapp verify
Wave 4 (serial)
- 4.1 Meta client and sending: text inside the window, templates with parameter validation, template sync per company, the media proxy, error mapping to failed, and "not configured". The mock gains the Graph endpoints and
/simulate/inbound.- Depends on: 3.2
- Scope:
solvway-services-whatsapp/**,local/whatsapp-mock/** - Verify:
mvn -T 1C -q -pl solvway-services-whatsapp verify
- 4.2 mobile-api admin API: every endpoint in design decision 9, module checks, company scoping (fail closed), audit, and the
userChangedcall from the user save path.- Depends on: 4.1
- Scope:
solvway-mobile-api/**(security code: also read the whole diff in the controller check) - Verify:
mvn -T 1C -q -pl solvway-mobile-api verify
Wave 5 (parallel: 5.1 and 5.2)
- 5.1 Portal inbox:
- the
/whatsapppage, with list tabs, search, thread, bubbles and ticks, the window state, the composer and template picker, media rendering, and assign controls for admins; - polling;
- proxies under
app/api/admin/whatsapp/**; routeModules.- Depends on: 4.2
- Scope:
solvway-admin-portal/app/whatsapp/**,solvway-admin-portal/app/api/admin/whatsapp/**,solvway-admin-portal/app/components/whatsapp/**,solvway-admin-portal/app/lib/services/whatsapp*,solvway-admin-portal/app/lib/routeModules* - Verify: portal verify
- the
- 5.2 Portal sidebar and buttons:
BO_WHATSAPPin the Leads section withMessageCircleand the unread badge;- WhatsApp buttons on leads and event leads rows and phone cards (start chat; told who owns it when someone else does).
- Depends on: 4.2
- Scope:
solvway-admin-portal/app/lib/aclSidebar*,solvway-admin-portal/app/components/app/**,solvway-admin-portal/app/leads/**,solvway-admin-portal/app/event-leads/**,solvway-admin-portal/app/lib/i18n/defaultMessages.ts - Verify: portal verify (5.1 adds its keys to
defaultMessages.tsafter 5.2 is integrated, to avoid a hotspot clash)
Wave 6 (serial: release)
-
6.1
docs/deployment.md: the environment per company, the SQL order, the Meta setup steps (webhook URL, verify token,messagessubscription, templates), and granting the modules. -
6.2 Live check on the local stack with the mock:
- inbound for INS and CV, kept apart;
- an unknown sender;
- automatic owner, and manual reassign that sticks;
- a disabled owner going to unassigned;
- a text reply inside the window and refused outside;
- template send with a missing parameter refused;
- start a chat from an event lead;
- media viewed;
- a failed send shown;
- the unread badge.
Use Playwright at 1280 and 360 px.
-
6.3 The owner's manual click-every-button e2e on a production build covers the inbox too (record the result here).