🇪🇸 WhatsApp + n8n con Evolution API: Oficial vs Baileys — Lo que aprendí a base de golpes

:united_kingdom: English version below


:spain: WhatsApp + n8n con Evolution API: Oficial vs Baileys — Lo que aprendí a base de golpes

El problema

Llevo meses montando automatizaciones de WhatsApp con n8n para agencias y veo el mismo error en todas partes: la gente conecta WhatsApp vía Baileys (código QR), se emociona porque es gratis, lo pone en producción… y le banean el número permanentemente en semanas.

Quiero compartir lo que he aprendido sobre los dos modos de Evolution API v2 y cuándo usar cada uno, porque la documentación no deja suficientemente claros los riesgos.

Modo 1: Baileys (Código QR) — SOLO para testing

Funciona como WhatsApp Web. Escaneas un QR, Evolution API crea una sesiĂłn web oculta y la expone como API REST.

Por qué engancha: Totalmente gratis, no necesitas Meta Business Manager, funciona con números personales, soporta mensajes en grupos (la API Oficial no).

Por qué te va a quemar: Meta detecta y banea activamente estas conexiones. El baneo es permanente — sin apelación, sin recuperación. El teléfono debe estar online. Si Meta actualiza el protocolo, tu API se rompe sin aviso. Tu proveedor de hosting puede recibir reportes de abuso de Meta.

He visto agencias perder nĂşmeros de clientes que llevaban meses construyendo. No merece la pena para producciĂłn.

Si aĂşn asĂ­ quieres probar con Baileys:

  • Usa una SIM de prepago desechable — nunca tu nĂşmero de empresa
  • Calienta el nĂşmero poco a poco (no mandes 100 mensajes el primer dĂ­a)
  • Busca que te respondan — los mensajes unidireccionales activan la detecciĂłn de spam
  • Añade delays aleatorios entre mensajes
  • Migra a la API Oficial antes de ir a producciĂłn

Modo 2: API Oficial de Meta (Cloud API) — Producción

Esta es la vía profesional. Requiere verificación en Meta Business Manager pero te da cero riesgo de baneo, templates enriquecidos (botones interactivos, catálogos), confirmaciones de entrega y lectura reales, y escala a miles de conversaciones.

La estructura de costes que la mayorĂ­a no entiende:

  • Marketing: ~0,05 € (Meta) vs ~0,07 € (BSP tĂ­pico) → ahorras 37%
  • Utilidad (pedidos, updates): ~0,02 € (Meta) vs ~0,03 € (BSP) → ahorras 40%
  • AutenticaciĂłn (OTP): ~0,03 € (Meta) vs ~0,05 € (BSP) → ahorras 40%
  • Servicio (iniciada por usuario): GRATIS en Meta vs ~0,01 € (BSP) → ahorras 100%

Esa Ăşltima es clave: cuando el usuario te escribe primero, Meta no te cobra nada durante 24 horas. La mayorĂ­a de BSPs (WATI, ManyChat, Twilio) sĂ­ te cobran por mensaje en esa ventana. Con Evolution API conectada directamente a la Cloud API de Meta, esas conversaciones de servicio son genuinamente gratis.

Conectándolo a n8n

Recibir mensajes (Webhook):

En tu instancia de Evolution API, activa Webhooks y apĂşntalos a tu URL de Webhook de ProducciĂłn en n8n. Habilita los eventos MESSAGES_UPSERT. Cada mensaje entrante llega a n8n como JSON:

{
  "data": {
    "key": {
      "remoteJid": "[email protected]"
    },
    "message": {
      "conversation": "Hola, necesito informaciĂłn sobre vuestros servicios"
    }
  }
}

Añadiendo un Agente IA:

Conecta el webhook a un nodo AI Agent:

  1. Usa el nodo AI Agent con el LLM que prefieras
  2. Conecta un Vector Store (yo uso Qdrant) para RAG — el agente responde basándose en tus documentos, precios, FAQs
  3. Define un System Prompt claro con tono e instrucciones de venta
  4. Añade Redis para memoria conversacional — sin esto, tu bot olvida lo que el usuario dijo hace 3 mensajes

Enviar la respuesta:

Un simple nodo HTTP Request de vuelta a Evolution API:

POST https://tu-evolution-api/message/sendText/tu-instancia

{
  "number": "34666555444",
  "text": "¡Hola! Claro, nuestros precios empiezan en..."
}

Flujo de arquitectura:

Usuario (WhatsApp)
  → Evolution API (webhook)
    → n8n (nodo Webhook)
      → AI Agent (LLM + Qdrant RAG + Redis memoria)
        → HTTP Request → Evolution API
          → El usuario recibe la respuesta en WhatsApp

Lecciones aprendidas

1. Siempre API Oficial para clientes. Baileys es una herramienta de prototipado, no una solución de producción. El coste “gratis” se vuelve muy caro cuando te banean un número.

2. Las conversaciones de servicio son tu mejor aliado. Diseña tus flujos para que los usuarios inicien el contacto (códigos QR en tarjetas de visita, enlaces “click to chat” en webs). Esa ventana gratuita de 24h es donde tu agente IA genera más valor a coste cero de mensajería.

3. Redis para memoria es innegociable. Un bot de WhatsApp sin estado se siente roto. Los usuarios esperan continuidad. Incluso una simple key de Redis con los Ăşltimos 5 mensajes transforma la experiencia.

4. Calienta los números de la API Oficial también. Incluso con la ruta oficial, no lances 10.000 mensajes de marketing el primer día. Meta tiene ratings de calidad. Empieza con conversaciones de servicio, construye tu rating, y luego escala las plantillas de marketing gradualmente.

5. Ejecuta Evolution API, Redis y n8n en la misma red privada. Si están en la misma red Docker, la latencia es sub-milisegundo y no necesitas exponer puertos a internet.

docker-compose.yml (simplificado)

Para los que quieran self-hostear el stack completo:

services:
  evolution-api:
    image: atendai/evolution-api:v2.1.0
    environment:
      - SERVER_URL=https://api.tudominio.com
      - DATABASE_PROVIDER=postgresql
      - DATABASE_CONNECTION_URI=postgresql://user:pass@postgres:5432/evolution
      - REDIS_ENABLED=true
      - REDIS_URI=redis://redis:6379
    ports:
      - "8080:8080"
    networks:
      - internal

  redis:
    image: redis:7-alpine
    networks:
      - internal

  postgres:
    image: postgres:16-alpine
    environment:
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=pass
      - POSTGRES_DB=evolution
    networks:
      - internal

networks:
  internal:
    driver: bridge

Tendréis que añadir n8n y vuestra base de datos vectorial a este compose, más configurar SSL (Caddy o Traefik funcionan bien como reverse proxies).

¿Alguien más está usando Evolution API en producción con la API Oficial de Meta? Me interesa saber vuestra experiencia con los quality ratings a escala.


:united_kingdom: WhatsApp + n8n via Evolution API: Official vs Baileys — What I learned the hard way

The problem

I’ve been building WhatsApp automations with n8n for agencies and I see the same mistake everywhere: people connect WhatsApp via Baileys (QR code), get excited because it’s free, deploy to production… and get permanently banned within weeks.

I wanted to share what I’ve learned about the two modes of Evolution API v2 and when to use each, because the documentation doesn’t make the risks clear enough.

Mode 1: Baileys (QR Code) — Testing ONLY

This works like WhatsApp Web. You scan a QR, Evolution API creates a hidden web session and exposes it as a REST API.

Why people love it: Completely free, no Meta Business Manager needed, works with personal numbers, supports group messages (Official API doesn’t).

Why it will burn you: Meta actively detects and bans these connections. Ban is permanent — no appeal, no recovery. Phone must stay online. If Meta updates the protocol, your API breaks silently. Your hosting provider may get abuse reports from Meta.

I’ve seen agencies lose client numbers they’d been building for months. Not worth it for production.

If you still want to test with Baileys:

  • Use a disposable prepaid SIM — never your business number
  • Warm up slowly (don’t blast 100 messages on day 1)
  • Encourage replies — one-way messaging triggers spam detection
  • Add random delays between messages
  • Migrate to Official API before going live

Mode 2: Official Meta Cloud API — Production

This is the real deal. Requires Meta Business Manager verification but gives you zero ban risk, rich templates (interactive buttons, catalogues), proper delivery receipts, and it scales to thousands of conversations.

The cost structure most people don’t understand:

  • Marketing conversations: ~€0.05 (Meta) vs ~€0.07 (typical BSP) → you save 37%
  • Utility (orders, updates): ~€0.02 (Meta) vs ~€0.03 (BSP) → you save 40%
  • Authentication (OTP): ~€0.03 (Meta) vs ~€0.05 (BSP) → you save 40%
  • Service (user-initiated): FREE from Meta vs ~€0.01 (BSP) → you save 100%

That last one is key: when the user writes to you first, Meta charges nothing for 24 hours. Most BSPs (WATI, ManyChat, Twilio) still charge you per message in that window. With Evolution API connected directly to Meta’s Cloud API, those service conversations are genuinely free.

Connecting it to n8n

Receiving messages (Webhook):

In your Evolution API instance, enable Webhooks and point them to your n8n Production Webhook URL. Enable MESSAGES_UPSERT events. Every incoming message hits n8n as JSON:

{
  "data": {
    "key": {
      "remoteJid": "[email protected]"
    },
    "message": {
      "conversation": "Hi, I need info about your services"
    }
  }
}

Adding an AI Agent:

Connect the webhook to an AI Agent node:

  1. Use the AI Agent node with your preferred LLM
  2. Connect a Vector Store (I use Qdrant) for RAG — the agent answers based on your docs, pricing, FAQs
  3. Set a clear System Prompt with tone and sales instructions
  4. Add Redis for conversation memory — without it, your bot forgets what the user said 3 messages ago

Sending the reply:

Simple HTTP Request node back to Evolution API:

POST https://your-evolution-api/message/sendText/your-instance

{
  "number": "34666555444",
  "text": "Hi! Sure, our pricing starts at..."
}

Architecture flow:

User (WhatsApp)
  → Evolution API (webhook)
    → n8n (Webhook node)
      → AI Agent (LLM + Qdrant RAG + Redis memory)
        → HTTP Request → Evolution API
          → User gets reply on WhatsApp

Lessons learned

1. Always use Official API for clients. Baileys is a prototyping tool, not a production solution. The “free” cost becomes very expensive when a number gets banned.

2. Service conversations are your best friend. Design your flows so users initiate contact (QR codes on business cards, “click to chat” links on websites). That 24h free window is where your AI agent generates the most value at zero message cost.

3. Redis for memory is non-negotiable. A stateless WhatsApp bot feels broken. Users expect continuity. Even a simple Redis key with the last 5 messages transforms the experience.

4. Warm up new Official API numbers too. Even with the official route, don’t blast 10,000 marketing messages on day one. Meta has quality ratings. Start with service conversations, build your rating, then scale marketing templates gradually.

5. Run Evolution API, Redis, and n8n on the same private network. If they’re on the same Docker network, latency is sub-millisecond and you don’t need to expose ports to the internet.

docker-compose.yml (simplified)

For those who want to self-host the full stack:

services:
  evolution-api:
    image: atendai/evolution-api:v2.1.0
    environment:
      - SERVER_URL=https://api.yourdomain.com
      - DATABASE_PROVIDER=postgresql
      - DATABASE_CONNECTION_URI=postgresql://user:pass@postgres:5432/evolution
      - REDIS_ENABLED=true
      - REDIS_URI=redis://redis:6379
    ports:
      - "8080:8080"
    networks:
      - internal

  redis:
    image: redis:7-alpine
    networks:
      - internal

  postgres:
    image: postgres:16-alpine
    environment:
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=pass
      - POSTGRES_DB=evolution
    networks:
      - internal

networks:
  internal:
    driver: bridge

You’ll need to add n8n and your vector DB to this compose file, plus configure SSL (Caddy or Traefik work well as reverse proxies).

Has anyone else been running Evolution API in production with the Official Meta API? Curious about your experience with message quality ratings at scale.

yeah the memory point is the big one — ran a similar stack (n8n + qdrant rag + redis) for client bots and the quality gap without session memory is huge. on quality ratings: starting with utility messages (order confirmations, appointment reminders) before marketing templates speeds up the warmup. users expect those so spam flags stay low, and once you’re green the marketing template throughput is way more predictable.

1 Like