All posts

WhatsApp AI bot for restaurants: complete architecture with Claude + Evolution API

2026-05-1011 min· Juan José Trujillo Cardozo

Several of our restaurant clients receive orders via WhatsApp. Before TRUJO, the flow required an employee to read, search the menu, reply, wait for confirmation, then enter the order in the POS. At 40 simultaneous messages on a Friday at 8pm, that breaks.

Why Evolution API over Meta's official Cloud API

Meta's official API can reach 3-5 seconds latency at peak. Evolution API (Baileys-based Node.js) keeps responses under 1 second for our volumes (under 1,000 messages/day per number). It is not officially supported by Meta but reliable in production for SMB volumes.

Conversation state in Redis

30-minute TTL per "conv:{tenant_id}:{phone}" key. State includes current stage (greeting, building_order, confirming, done), order items in progress, last 10 message turns, and restaurant tenant ID.

Menu catalog from Loggro POS

Synced every 4 hours. Menus around 200 products per site. Normalization (strip accents, uppercase, trim) deduplicates before Redis storage. Confirmed POS typos filtered automatically.

Claude Haiku as the AI brain

300-600ms latency vs Sonnet's 1.2-2.5s — the difference is perceptible for restaurant customers. System prompt includes top 50 products by query frequency, current order state, and business rules. History truncated to 10 turns. Cost per average 8-turn conversation: ~$0.0004 USD.

Supervised mode: the expensive lesson

We launched fully autonomous. Employees rejected bot-originated orders after one week — they didn't trust the confirmation flow. Pivoted to JSON-configurable schedule per tenant with a daily 10pm Telegram report (conversations started, orders completed, orders abandoned). Langfuse self-hosted for Claude call tracing.

At Friday 7-9pm peak: 15-25 concurrent conversations with no observable degradation.