Webhook-Ready Conversational Assistant with Google Gemini and Session Memory - n8n Workflow

Deploy a powerful, real-time conversational AI assistant using this n8n workflow. Integrates Google Gemini, uses session memory, and responds instantly via a dedicated n8n webhook trigger.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Developers or engineers looking to integrate AI chat functionality into existing web applications or mobile apps without building a complex backend.
Product managers needing to deploy a fast, context-aware customer support bot.
Users seeking powerful n8n templates for advanced AI agent creation.
Anyone needing a reliable, session-aware n8n workflow accessible via a simple HTTP request.

Overview

This robust n8n workflow provides a complete solution for building a conversational AI assistant that maintains context over multiple interactions—a crucial feature for any effective chatbot. Unlike basic API calls, this n8n setup handles state management using the Simple Memory n8n node. By utilizing a dedicated n8n trigger (the Webhook), this automation can be instantly integrated into chat widgets, messaging apps (like WhatsApp or Telegram via adapters), or custom dashboards. The use of the Google Gemini Chat Model ensures high-quality, relevant, and rapid responses. This specific n8n workflow template solves the significant challenge of managing session history externally, keeping your application integration lightweight and efficient. It's a prime example of leveraging the AI Agent n8n node for sophisticated logic.

How it Works

The entire process begins with the Webhook n8n trigger, which must receive a POST request containing both the user's message and a unique sessionId (for session tracking).


  1. Trigger: The Webhook n8n node activates upon receiving the external request.

  2. Session Context Retrieval: The input data (specifically the sessionId) is passed to the Simple Memory n8n node. This memory n8n node retrieves the conversation history associated with that unique ID, allowing the AI to understand the context.

  3. AI Processing: The AI Agent n8n node receives the user's current message, the system instructions ('You are a helpful AI assistant...'), and the retrieved conversation history.

  4. Language Model Execution: The AI Agent utilizes the connected Google Gemini Chat Model n8n node to generate a response based on the full context. The Gemini 2.0 Flash model is configured for fast, production-ready responses.

  5. Memory Update: After the response is generated, the AI Agent updates the Simple Memory n8n node, saving the new interaction (user message and AI response) for the next turn.

  6. Response: Finally, the Respond to Webhook n8n node immediately returns the AI-generated answer back to the application that initiated the original request, completing the real-time interaction loop. This complete n8n workflow ensures low latency and contextual accuracy.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON and import it directly into your n8n instance via the 'New' menu -> 'Import from JSON'.

  2. Set Up Google Gemini Credentials:

Locate the Google Gemini Chat Model n8n node.
Click on the credentials section and create a new Google Gemini API credential, providing your API key.

  1. Configure the Webhook n8n Trigger:

Open the Webhook n8n node.
Save the workflow and ensure it is activated. n8n will provide a unique testing and production URL for this specific n8n trigger.

  1. Integration Setup: Your external application must send POST requests to the generated n8n Webhook URL. The payload must strictly include message (the user's query) and sessionId (a unique ID, like a user ID or chat session ID, which allows the Simple Memory n8n node to function correctly).

  2. Activation: Set the n8n workflow to 'Active' to start listening for incoming requests.

Node Details

Webhook (n8n trigger):
Function: Serves as the real-time entry point for external applications. It initiates the n8n workflow upon receiving a POST request.
Key Configuration: Configured to expect a POST method and uses the Respond to Webhook n8n node for synchronous response handling.
AI Agent (n8n node):
Function: The central orchestration node. It receives the input, manages memory interaction, and executes the language model based on a detailed system prompt, defining the AI persona.
Key Configuration: Contains a custom system prompt ensuring the assistant is 'helpful, accurate, concise, and friendly'.
Google Gemini Chat Model (n8n node):
Function: Provides the LLM capabilities for the AI Agent. It handles the actual text generation.
Key Configuration: Uses models/gemini-2.0-flash for high speed.
Simple Memory (n8n node):
Function: Manages the conversation history (stateful context). Essential for creating a fluid, conversational experience.
Key Configuration: Uses a Buffer Window Memory and dynamically extracts the sessionKey from the incoming webhook payload using ={{ $json.body.sessionId }}.
Respond to Webhook (n8n node):
Function: Ensures the n8n workflow returns the generated AI response instantly to the original calling application.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by
David Olusola
David Olusola

AI automation consultant working with ambitious businesses on their most complex operational challenges. For project inquiries, reach me at [email protected]

Featured*