Idempotent sends
Use stable client ids when the transport supports them. Retry failed sends with the same id so duplicates do not create twin bubbles.Scope memory per conversation
Store agent state keyed byspace.to or message.group?.chatId — not globally per user phone, unless you explicitly want cross-chat memory.
Failure audit log
Persistapp.on("error", …) events with to, code, and message. They indicate deliverability or entitlement issues before users report them.
Webhook deduplication
When using webhooks, unique-indexeventId so at-least-once delivery does not double-charge your agent.