Skip to main content

Create a human-like Evolution API WhatsApp agent with Redis, PostgreSQL and Gemini

Workflow preview

Workflow preview
100%
Create a human-like Evolution API WhatsApp agent with Redis, PostgreSQL and Gemini preview
Open on n8n.io

1. Workflow Overview

Human like Evolution API Agent with Redis & PostgreSQL This production ready template builds a sophisticated AI Agent using Evolution API that mimics human interaction patterns. Unlike standard ...

Best for

  • Support Chatbot automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-evolution-api.evolutionapi, n8n-nodes-base.set, n8n-nodes-base.switch, n8n-nodes-base.redis, n8n-nodes-base.noop, n8n-nodes-base.if, n8n-nodes-base.wait, @n8n/n8n-nodes-langchain.lmchatgooglegemini

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by John Alejandro SIlva.

Original n8n.io source

1.1 Workflow description

Title
Create a human-like Evolution API WhatsApp agent with Redis, PostgreSQL and Gemini
Workflow name
Create a human-like Evolution API WhatsApp agent with Redis, PostgreSQL and Gemini

πŸ€– Human-like Evolution API Agent with Redis & PostgreSQL

This production-ready template builds a sophisticated AI Agent using Evolution API that mimics human interaction patterns. Unlike standard chatbots that reply instantly to every incoming message, this workflow uses a Smart Redis Buffering System. It waits for the user to finish typing their full thought (text, audio, or image albums) before processing, creating a natural, conversational flow.

It features a Hybrid Memory Architecture: active conversations are cached in Redis for ultra-low latency, while the complete chat history is securely stored in PostgreSQL. To optimize token usage and maintain long-term coherence, a Context Refiner Agent summarizes the conversation history before the Main AI generates a response.

✨ Key Features

  • Human-like Buffering: The agent waits (configurable time) to group consecutive messages, voice notes, and media albums into a single context. This prevents fragmented replies and feels like talking to a real person.
  • Hybrid Memory: Combines Redis (Hot Cache) for speed and PostgreSQL (Cold Storage) for permanent history.
  • Context Refinement: A specialized AI step summarizes past interactions, allowing the Main Agent to understand long conversations without exceeding token limits or increasing costs.
  • Multi-Modal Support: Natively handles text, audio transcription, and image analysis via Evolution API.
  • Parallel Processing: Manages "typing..." status and session checks in parallel to reduce response latency.

πŸ“‹ Requirements

To use this workflow, you must configure the Evolution API correctly:

  1. Evolution API Instance: You need a running instance of Evolution API.
  1. N8n Community Node: Install the Evolution API node in your n8n instance.
  1. Database: A PostgreSQL database for chat history and a Redis instance for the buffer/cache.
  2. AI Models: API keys for your LLM (OpenAI, Anthropic, or Google Gemini).

βš™οΈ Setup Instructions

  1. Install the Node: Go to Settings > Community Nodes in n8n and install n8n-nodes-evolution-api.
  2. Credentials: Configure credentials for Redis, PostgreSQL, and your AI provider (e.g., OpenAI/Gemini).
  3. Database Setup: Create a chat_history table in PostgreSQL (columns must match the Insert node).
  4. Redis Connection: Configure your Redis credentials in the workflow nodes.
  5. Global Variables: Set the following in the "Global Variables" node:
  • wait_buffer: Seconds to wait for the user to stop typing (e.g., 5s).
  • wait_conversation: Seconds to keep the cache alive (e.g., 300s).
  • max_chat_history: Number of past messages to retrieve.
  1. Webhook: Point your Evolution API instance to this workflow's Webhook URL.

πŸš€ How it Works

  1. Ingestion: Receives data via Evolution API. Detects if it's text, audio, or an album.
  2. Smart Buffering: Holds the execution to collect all parts of the user's message (simulating a human reading/listening).
  3. Context Retrieval: Checks Redis for the active session. If empty, fetches from PostgreSQL.
  4. Refinement: The Refiner Agent summarizes the history to extract key details.
  5. Response: The Main Agent generates a reply based on the refined context and current buffer, then saves it to both Redis and Postgres.

πŸ’‘ Need Assistance?

If you’d like help customizing or extending this workflow, feel free to reach out:

πŸ“§ Email: [email protected] πŸ”— LinkedIn: John Alejandro Silva RodrΓ­guez

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Descargar Media

Type / Role
n8n-nodes-evolution-api.evolutionApi - evolutionApi
Config choices
Version 1

Block 2 - get_message (text)

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Message Type

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.3

Block 4 - Global Variables

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 5 - Buffer Route

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 6 - Push to Buffer

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 7 - Get From Buffer

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 8 - Delete Buffer

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 9 - Normalize Buffer

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 10 - No Operation, do nothing

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 11 - Push to Buffer (AlbumGroup)

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 12 - Check AlbumGroup

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 13 - Push Media to Buffer

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 14 - Completed?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 15 - Delete Media Buffer

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 16 - Normalize MediaGroup Buffer

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 17 - Get Album From Buffer

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 18 - Album?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 19 - Get Message

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 20 - Delete Buffer (chat_history)

Type / Role
n8n-nodes-base.redis - redis
Config choices
Version 1

Block 21 - Wait For User Other Fast Message

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 22 - Get chat_history

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 23 - No Operation, do nothing1

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 24 - Buffer (chat_history) Route

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Showing the first 24 of 103 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Create a human-like Evolution API WhatsApp agent with Redis, PostgreSQL and Gemini
Complexity advanced
Nodes 103
Categories Support Chatbot, AI RAG
Author John Alejandro SIlva
Published 15 Feb 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/13407/13407.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Create a human-like Evolution API WhatsApp agent with Redis, PostgreSQL and Gemini do?

Human like Evolution API Agent with Redis & PostgreSQL This production ready template builds a sophisticated AI Agent using Evolution API that mimics human interaction patterns. Unlike standard ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot, AI RAG use case.