AutomationFlowsAI & RAG › Create a Slack Chatbot with Gpt-4o for Automated Responses

Create a Slack Chatbot with Gpt-4o for Automated Responses

ByRobert Breen @rbreen on n8n.io

This workflow integrates Slack with an OpenAI Chat Agent to create a fully interactive chatbot inside your Slack workspace.

Chat trigger trigger★★★★☆ complexityAI-powered9 nodesOpenAI ChatSlackAgentChat Trigger
AI & RAG Trigger: Chat trigger Nodes: 9 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #7734 — we link there as the canonical source.

This workflow follows the Agent → Chat Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "e1ed7ed9-efff-4003-933d-7bf9d0b8949b",
      "name": "OpenAI Chat Model8",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1168,
        11920
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "62d0e051-8bb1-4206-8fa7-19f93a7e30ea",
      "name": "Sticky Note61",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1904,
        11344
      ],
      "parameters": {
        "color": 7,
        "width": 1488,
        "height": 928,
        "content": "# \ud83d\udcac OpenAI Chat Agent with Slack Listening\n\nThis workflow connects a chatbot to **Slack**.  \nIt listens to user messages, sends them to an **OpenAI agent**, and replies back in the same Slack channel.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c65f1027-8100-4b78-af28-c99bccb903bb",
      "name": "Sticky Note20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2352,
        11344
      ],
      "parameters": {
        "width": 400,
        "height": 928,
        "content": "\n## \u2699\ufe0f Setup Instructions\n\n### 2\ufe0f\u20e3 Connect Slack API\n1. Create an app \u2192 <https://api.slack.com/apps>  \n2. **OAuth & Permissions** \u2192 add scopes you need to read channel history (typical:  \n   `channels:history`, `groups:history`, `im:history`, `mpim:history`, plus `channels:read`, `groups:read`, `users:read`. Add `chat:write` if you want the bot to reply in Slack.)  \n3. **Install** the app to your workspace \u2192 copy the **Bot User OAuth Token**  \n4. In n8n \u2192 **Credentials \u2192 New \u2192 Slack OAuth2 API** \u2192 paste token and save  \n5. In the **Slack History** node, select your Slack credential and the **Channel ID** to read\n\n\n\n\n## \ud83d\udcec Contact\nNeed help customizing this (e.g., filtering by list, or sending reports by email/Slack)?  \n\n\ud83d\udce7 **robert@ynteractive.com**  \n\ud83d\udd17 **[Robert Breen](https://www.linkedin.com/in/robert-breen-29429625/)**  \n\ud83c\udf10 **[ynteractive.com](https://ynteractive.com)**\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1a88867a-350a-42cf-872e-ce2c9074d6c5",
      "name": "Send User Message in Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1504,
        12080
      ],
      "parameters": {
        "text": "=*User:* {{ $json.chatInput }}",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "U09ADJPB7QA",
          "cachedResultName": "rbreen672"
        },
        "select": "user",
        "otherOptions": {
          "includeLinkToWorkflow": false
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "434201a3-a5d9-434c-b8c0-f7a13e0dcb41",
      "name": "Sample Chat Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1136,
        11680
      ],
      "parameters": {
        "text": "={{ $('Sample Chatbot').item.json.chatInput }}",
        "options": {
          "systemMessage": "=you are an ecommerce bot. help the user as if you were working for a mock store. "
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "d0effa88-1f30-4e6a-a5b3-3edc90d726d2",
      "name": "Send Agents Response in Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        -784,
        11856
      ],
      "parameters": {
        "text": "=*Chatbot:* {{ $json.output }}",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": "U09ADJPB7QA",
          "cachedResultName": "rbreen672"
        },
        "select": "user",
        "otherOptions": {
          "includeLinkToWorkflow": false
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "f9e1139f-2868-467c-aa21-fdd4920d0bd0",
      "name": "Format Response",
      "type": "n8n-nodes-base.code",
      "position": [
        -640,
        11632
      ],
      "parameters": {
        "jsCode": "return [{ json: { text:$('Sample Chat Agent').first().json.output } }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "309558fd-dea7-4634-a5b7-a02b0df2bbcf",
      "name": "Sticky Note66",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1568,
        11552
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 640,
        "content": "### 2\ufe0f\u20e3 Connect Slack API\n1. Create an app \u2192 <https://api.slack.com/apps>  \n2. **OAuth & Permissions** \u2192 add scopes you need to read channel history (typical:  \n   `channels:history`, `groups:history`, `im:history`, `mpim:history`, plus `channels:read`, `groups:read`, `users:read`. Add `chat:write` if you want the bot to reply in Slack.)  \n3. **Install** the app to your workspace \u2192 copy the **Bot User OAuth Token**  \n4. In n8n \u2192 **Credentials \u2192 New \u2192 Slack OAuth2 API** \u2192 paste token and save  \n5. In the **Slack History** node, select your Slack credential and the **Channel ID** to read\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bbb5baca-6411-4d41-8530-3aff0a228513",
      "name": "Sample Chatbot",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1792,
        11696
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    }
  ],
  "connections": {
    "Sample Chatbot": {
      "main": [
        [
          {
            "node": "Send User Message in Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sample Chat Agent": {
      "main": [
        [
          {
            "node": "Send Agents Response in Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model8": {
      "ai_languageModel": [
        [
          {
            "node": "Sample Chat Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send User Message in Slack": {
      "main": [
        [
          {
            "node": "Sample Chat Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Agents Response in Slack": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow integrates Slack with an OpenAI Chat Agent to create a fully interactive chatbot inside your Slack workspace.

Source: https://n8n.io/workflows/7734/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Perfect for educators, consultants, and content creators who record sessions and want to repurpose them into social media posts, videos, and images without manual work. Chat interface triggers the AI

Chat Trigger, OpenAI Chat, Memory Buffer Window +9
AI & RAG

Prospect Bot - template. Uses chatTrigger, httpRequest, slack, chat. Chat trigger; 25 nodes.

Chat Trigger, HTTP Request, Slack +4
AI & RAG

Streamline the final stage of your content production workflow by automating publishing, formatting, metadata generation, and approval routing. This AI-powered subworkflow pulls optimized drafts from

Google Sheets Tool, Memory Buffer Window, Agent +6
AI & RAG

Executeworkflow Slack. Uses stickyNote, chatTrigger, lmChatOpenAi, memoryBufferWindow. Chat trigger; 17 nodes.

Chat Trigger, OpenAI Chat, Memory Buffer Window +4
AI & RAG

This is a workflow that tries to answer user queries using the standard GPT-4 model. If it can't answer, it sends a message to Slack to ask for human help. It prompts the user to supply an email addre

Chat Trigger, OpenAI Chat, Memory Buffer Window +4