Best practices
Patterns and rules that make flows more reliable, easier to maintain, and cost-efficient.
Reference
- Name your nodes
- Give each node a descriptive name (not «Node 3» but «Get customer by ID»). The execution history becomes readable.
- One node = one responsibility
- Each node does one thing. A node that does 5 things is hard to debug.
- Gate before costly API
- If you have a condition before an API or AI call, the flow doesn't consume if the condition isn't met.
- KV for session state
- Don't use canvas global variables for per-user state. Use KV Store with user+channel scope.
- max_tokens in agents
- Limit AI agent output to ≤1024 tokens for messaging channels. Avoids exceeding WhatsApp/Telegram limits.
- Pause before editing
- Always pause the flow before changing nodes or connections in production.
- Export before big changes
- Export a template as backup before refactoring.
- No orphan nodes
- Every node must be connected to the main graph. An orphan node blocks execution.
- Test in dev first
- Use a development channel (Meta test number or a separate Telegram bot) before activating on the production channel.
Next step
Learn to manage conversations in the Inbox.