Why it matters
Per-chat rate limits in Redis (INCR + EXPIRE or token buckets) protect your bot and the upstream platform APIs.
Practical steps
- Key by platform + chat/user id + action class.
- Prefer token buckets for bursty UX.
- Fail closed for expensive actions (broadcast, LLM).
- Return a clear retry-after to the user.
- Monitor key cardinality and eviction.
Watch out for
- Global limits only — one noisy chat starves others.
- No TTL on rate-limit keys.