n8n Workflow
Advanced

Google Gemini Powered Slack Assistant with Conversation Memory

Build an intelligent Slack assistant using Google Gemini. This workflow automates responses, maintains conversation history, and provides personalized assistance directly in your Slack channels.

Overview

Create a conversational AI Slack bot powered by Google Gemini that remembers past interactions within a conversation to provide context-aware assistance.

🧠 Description & Use Case

This workflow creates a sophisticated, AI-powered Slack assistant named "Effibotics Bot". It leverages Google Gemini to understand and respond to user queries and, crucially, maintains a conversation history to provide context-aware and more human-like interactions directly within your Slack workspace.

🔄 How It Works:

  1. Receive Slack Message

    • The Webhook to receive message node acts as an endpoint, listening for POST requests sent from a Slack slash command or bot mention.
  2. Process with AI Agent

    • The text from the user's message is passed to the Agent node. This agent is configured with a system message, defining its persona as a helpful assistant specializing in automation.
  3. Engage the AI Brain (Google Gemini)

    • The Agent utilizes the Google Gemini Chat Model to process the user's query and generate an intelligent and relevant response.
  4. Maintain Conversation Context

    • The Window Buffer Memory node is the key to conversational context. It stores the last 10 exchanges of the conversation, using the Slack token as a unique session ID. This allows the bot to remember what was said previously in the same thread or channel interaction.
  5. Send Response to Slack

    • The AI-generated response is sent back to the original Slack channel using the Send response back to slack channel node. The message is formatted to show the original query and the bot's answer, creating a clear and interactive dialogue.

✅ Real-World Use Cases:

  • Internal Support Bot: Instantly answer employee questions about HR policies, IT troubleshooting, or company-wide announcements.
  • Developer Assistant: Help engineering teams by answering technical questions, looking up documentation, or explaining code snippets without leaving Slack.
  • Team Knowledge Base: Act as a conversational front-end for your team's documents, allowing users to ask questions instead of manually searching for information.
  • Customer Support Triage: Field initial customer queries in a shared Slack channel, providing instant answers to common questions and freeing up support agents for more complex issues.
  • Onboarding Assistant: Guide new hires by answering their questions in a dedicated onboarding channel, making their integration smoother.

Instructions

Basic steps

  1. Download workflow JSON
  2. Import into n8n
  3. Configure node parameters as needed
  4. Test and enable the workflow

💡 Tips

After importing, verify all connectors and credentials match your environment.

Preview

Workflow Visualization

10 nodes
100%
Sticky NotestickyNoteSticky Note2stickyNoteSticky Note3stickyNoteGoogle Gemini Chat Model@n8n/langchain.lmChatGoogleGeminiWindow Buffer Memory@n8n/langchain.memoryBufferWindowSticky Note4stickyNoteSticky Note1stickyNoteSend response back to slack channelslackWebhook to receive messagewebhookAgent@n8n/langchain.agent

Nodes

1

Sticky Note

stickyNote

v1
2

Sticky Note2

stickyNote

v1
3

Sticky Note3

stickyNote

v1
4

Google Gemini Chat Model

@n8n/langchain.lmChatGoogleGemini

v1
5

Window Buffer Memory

@n8n/langchain.memoryBufferWindow

v1.2
6

Sticky Note4

stickyNote

v1
7

Sticky Note1

stickyNote

v1
8

Send response back to slack channel

slack

v2.1
9

Webhook to receive message

webhook

v1
10

Agent

@n8n/langchain.agent

v1

Statistics

Total nodes:10
Disabled nodes:0
Node types:6
Connections:4
View full JSON structure
{
  "nodes": [
    {
      "id": "2ce91ec6-0a8c-438a-8a18-216001c9ee07",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        240
      ],
      "parameters": {
        "width": 407.6388140161723,
        "height": 490.2476912200079,
        "content": "## This is a POST Webhook endpoint\n\nMake sure to configure this webhook using a https:// wraper and dont use the default http://localhost:5678 as that will not be recognized by your slack webhook\n\n\nOnce the data has been sent to your webhook, the next step will be passing it via an AI Agent to process data based on the queries we pass to our agent.\n\nTo have some sort of a memory, be sure to set the slack token to the memory node. This way you can refer to other chats from the history.\n\nThe final message is relayed back to slack as a new message. Since we can not wait longer than 3000 ms for slack response, we will create anew message with reference to the input we passed.\n\nWe can advance this using the tools or data sources for it to be more custom tailored for your company.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7a0c84a8-90ef-4de8-b120-700c94c35a51",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1180,
        560
      ],
      "parameters": {
        "color": 4,
        "width": 221.7358490566037,
        "height": 233,
        "content": "### Conversation history is stored in memory using the body token as the chatsession id"
      },
      "typeVersion": 1
    },
    {
      "id": "9b843e0e-42a6-4125-8c59-a7d5620a15f7",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        942.5229110512129,
        560
      ],
      "parameters": {
        "color": 4,
        "width": 217.4770889487872,
        "height": 233,
        "content": "### The chat LLM to process the prompt. Use any AI model here"
      },
      "typeVersion": 1
    },
    {
      "id": "4efa968f-ebf5-42ec-80d3-907ef2622c61",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1020,
        640
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-1.5-flash-latest"
      },
      "typeVersion": 1
    },
    {
      "id": "fd1efd7c-7cd0-4edf-960e-19bd4567293e",
      "name": "Window Buffer Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1260,
        660
      ],
      "parameters": {
        "sessionKey": "={{ $('Webhook to receive message').item.json.body.token }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.2
    },
    {
      "id": "60d1eb77-492d-4a18-8cec-fa3f6ef8d707",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1467.514824797844,
        260
      ],
      "parameters": {
        "color": 4,
        "width": 223.7196765498655,
        "height": 236.6615202952029,
        "content": "### Send the response from AI back to slack channel\n"
      },
      "typeVersion": 1
    },
    {
      "id": "186069c0-5c79-4738-9924-de33998658bc",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        840,
        180
      ],
      "parameters": {
        "color": 4,
        "width": 561.423180592992,
        "height": 340.0970350404311,
        "content": "## Receive a POST webhook, process data and return response"
      },
      "typeVersion": 1
    },
    {
      "id": "2bfce117-a769-46e1-a028-ed0c7ba62653",
      "name": "Send response back to slack channel",
      "type": "n8n-nodes-base.slack",
      "position": [
        1540,
        320
      ],
      "parameters": {
        "text": "={{ $('Webhook to receive message').item.json.body.user_name }}: {{ $('Webhook to receive message').item.json.body.text }}\n\nEffibotics Bot: {{ $json.output.removeMarkdown() }} ",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Webhook to receive message').item.json.body.channel_id }}"
        },
        "otherOptions": {
          "mrkdwn": true,
          "sendAsUser": "Effibotics Bot",
          "includeLinkToWorkflow": false
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "cfcf2bbc-8ed5-4a9f-8f35-cf2715686ebe",
      "name": "Webhook to receive message",
      "type": "n8n-nodes-base.webhook",
      "position": [
        880,
        320
      ],
      "webhookId": "28b84545-96aa-42f5-990b-aa8783a320ca",
      "parameters": {
        "path": "slack-bot",
        "options": {
          "responseData": ""
        },
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "dc93e588-fc0b-4561-88a5-e1cccd48323f",
      "name": "Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1100,
        320
      ],
      "parameters": {
        "text": "={{ $json.body.text }}",
        "options": {
          "systemMessage": "You are Effibotics AI personal assistant. Your task will be to provide helpful assistance and advice related to automation and such tasks. "
        }
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Agent": {
      "main": [
        [
          {
            "node": "Send response back to slack channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Webhook to receive message": {
      "main": [
        [
          {
            "node": "Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Actions

Share
Categories:
Tags:
slackwebhookstickynote

Technical Specs

Complexity:
Advanced
Node Count:
10 nodes
Published:11 months ago
Updated:6 months ago

Compatibility

Platform:
N8N Cloud & Self-hosted
Min Version:
N8N v1.0.0+
Supports cloud and self-hosted deployment

License

This workflow template follows MIT license, you can freely use, modify and distribute.

Please comply with relevant third-party service terms when using.

Related Workflows