Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/KevinhosUTP/Automatizacion-Lurwis/llms.txt

Use this file to discover all available pages before exploring further.

n8n Installation & Setup

This guide covers installing n8n (self-hosted or cloud) and configuring it for the Automatización Lurwis platform.

Prerequisites

Before installing n8n, ensure you have:
  • Node.js 18+ (for self-hosted)
  • PostgreSQL 12+ database
  • MongoDB 4.4+ for conversation memory
  • Redis 6+ for message buffering
  • WhatsApp Business API credentials
  • Google Gemini API key

Installation Options


Workspace Configuration

Import Workflows

After installation, import the two main workflows:
1

Navigate to Workflows

In n8n interface, click WorkflowsImport from File
2

Import Receptor workflow

Upload: workflows/Picantería Lurwis _ Receptor.jsonThis workflow handles:
  • WhatsApp webhook verification
  • Message reception and validation
  • Redis buffering (6-8 second window)
  • Error handling
3

Import Procesador workflow

Upload: workflows/Picantería Lurwis _ Procesador.jsonThis workflow handles:
  • Message classification
  • AI agent routing
  • Order processing
  • Database operations
4

Activate workflows

Click Active toggle for both workflows

Credential Management

Configure credentials for all integrations:

WhatsApp Business API

1

Add WhatsApp credential

  1. Go to CredentialsNew
  2. Select WhatsApp
  3. Enter:
    • Access Token: Your Meta access token
    • Phone Number ID: 947279508470714 (from workflow)
2

Configure webhook

  • Webhook URL: https://your-domain.com/webhook/meta-verify
  • Verify Token: meta-verify

PostgreSQL Database

1

Add Postgres credential

Name: Postgres Lurwis db
Host: your-postgres-host
Database: picanteria_db
User: your-user
Password: your-password
Port: 5432
SSL: Require (production)
2

Connection string format

The workflows use session pooler connection:
postgresql://user:password@host:5432/picanteria_db?sslmode=require
The workflows note mentions “CONNECTION STRING (SESSION POOLER)” with RLS (Row Level Security) enabled.

MongoDB Memory

1

Add MongoDB credential

Name: Memoria chats Lurwis
Connection String: mongodb+srv://user:password@cluster.mongodb.net/
Database: picanteria_db
2

Collections used

The system uses separate collections for conversation memory:
  • historial_clasificador - Message classification
  • historial_detector - Order detection
  • historial_pedidos - Order conversations (25 message window)
  • historial_eventos - Event bookings (15 message window)
  • historial_reservas - Table reservations (15 message window)
  • historial_general - General inquiries (10 message window)

Redis Buffer

1

Add Redis credential

Name: Buffer Lurwis
Host: your-redis-host
Port: 6379
Password: your-redis-password
Database: 0
2

TTL configuration

Redis keys use automatic expiration:
  • Buffer messages: 30 seconds
  • Timestamps: 30 seconds
  • Metadata: 120 seconds

Google Gemini AI

1

Add Google Gemini credential

Name: Modelo Lurwis
API Key: your-gemini-api-key
2

Get API key

  1. Go to Google AI Studio
  2. Create new API key
  3. Copy and save securely

Workflow Settings

Execution Settings

Both workflows use executionOrder: v1 for sequential processing.

Error Workflow

The workflows reference an error notification workflow that sends failures to a personal WhatsApp number. Configure this separately for production monitoring.
To create an error workflow:
  1. Create new workflow named “Error Notifications”
  2. Add Error Trigger node
  3. Add WhatsApp node to send error details
  4. In main workflows, go to SettingsError Workflow → Select “Error Notifications”

Webhook Configuration

Meta WhatsApp Verification

The Receptor workflow handles Meta’s webhook verification:
  • Path: /webhook/meta-verify
  • Method: GET and POST
  • Verify Token: meta-verify
  • Response Mode: Response Node (for proper Meta acknowledgment)
1

Configure in Meta Developer Console

  1. Go to WhatsApp Business API settings
  2. Add webhook URL: https://your-domain.com/webhook/meta-verify
  3. Verify token: meta-verify
  4. Subscribe to: messages field
2

Test webhook

Meta will send a verification request. The workflow returns:
Status: 200
Body: hub.challenge value

Performance Tuning

Execution Limits

EXECUTIONS_DATA_PRUNE=true
EXECUTIONS_DATA_MAX_AGE=336  # 14 days
N8N_CONCURRENCY=10

Memory Settings

For high-traffic production:
NODE_OPTIONS=--max-old-space-size=4096

Next Steps

Environment Variables

Configure all required environment variables

Production Checklist

Review production deployment requirements

Database Schema

Understand the database structure

Troubleshooting

Common issues and solutions