Summary
WhatsApp Cloud API only allows free-form messages within 24 hours of the user's last message; outside that window, only pre-approved message templates can be sent. This directly affects the async notifications the transaction-status-tracking issue needs to send.
Description
Track the timestamp of each user's last inbound message (extending the users table) to know whether the 24-hour session window is currently open.
For any backend-initiated message sent outside the window (e.g. 'your delayed swap just confirmed'), fall back to a pre-approved WhatsApp message template instead of free-form text — this requires template registration with Meta, which is an external, one-time setup step to document.
Update services/whatsapp.ts's sendText (or add a sendTemplate alongside it) to branch on window state.
Add tests asserting the correct send path is chosen based on last-message recency.
Deliverables
- Session-window tracking per user
- Template-message fallback path in the WhatsApp service
- Documentation of the Meta template registration step
- Tests for window-open vs. window-closed branching
Dependencies
Summary
WhatsApp Cloud API only allows free-form messages within 24 hours of the user's last message; outside that window, only pre-approved message templates can be sent. This directly affects the async notifications the transaction-status-tracking issue needs to send.
Description
Track the timestamp of each user's last inbound message (extending the
userstable) to know whether the 24-hour session window is currently open.For any backend-initiated message sent outside the window (e.g. 'your delayed swap just confirmed'), fall back to a pre-approved WhatsApp message template instead of free-form text — this requires template registration with Meta, which is an external, one-time setup step to document.
Update
services/whatsapp.ts'ssendText(or add asendTemplatealongside it) to branch on window state.Add tests asserting the correct send path is chosen based on last-message recency.
Deliverables
Dependencies