ChatGPTWorkPlanningAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

Slack AI Chatbot (n8n Template)

Slack message → Webhook trigger → Filter bot → AI Agent processing → Reply to Slack

Some experienceStepsWorkflowPrompt
Who
Teams needing to deploy an AI chatbot in Slack
You get
When users @mention the bot in Slack, receive an AI reply with search and memory capabilities
You need
n8n · slack · serpapi

Constraints

Prerequisites: n8n 1.19.4+ instance; OpenAI API key; Slack API credentials; SerpAPI credentials (optional, for search). Import the official template, then configure credentials and parameters in node order.

What they did

The n8n official team created a Slack AI chatbot template. The workflow receives Slack messages via Webhook, uses an If node to filter out bot messages, and passes user messages to the AI Agent node. The AI Agent calls gpt-4o-mini as the language model, connects to Simple Memory keyed by channel ID for conversation context, optionally calls SerpAPI and Wikipedia tools for information lookup, and finally sends the AI reply back via the Slack node.

How it went

Template published on n8n platform, requiring n8n 1.19.4+. Template view count was 45,258 at time of collection (author_report).

Worth knowing

The system prompt sets a 'Gilfoyle' persona with sharp sarcasm; replace according to team culture for production. SerpAPI requires an additional API key and incurrs costs; if only encyclopedia lookup is needed, keep only the Wikipedia tool. Simple Memory uses channel ID + suffix for multi-channel isolation, but data is lost on n8n instance restart—swap to database storage for persistence.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • OpenAI Chat Model node: connect OpenAI API credentials.
  • SerpAPI node: connect serpApi credentials.
  • Slack node: connect Slack API credentials.

Configuration to replace

  • Source template is n8n public workflow #1961 (~14 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-25

Steps

  1. Import template and prepare credentials

    Open the template link in n8n and import the 'Slack chatbot powered by AI' workflow. Prepare three credentials: OpenAI API key (for the AI Agent chat model), Slack API credentials (for sending/receiving messages), and SerpAPI credentials (optional, for Google search tool). Create openAiApi, slackApi, and serpApi credentials in n8n Credentials.

  2. Configure Webhook trigger

    Locate the Webhook node, confirm HTTP Method is POST and Path is slack-gilfoyle (or customize). In Slack's Event Subscriptions, set this Webhook URL as the Request URL and subscribe to message.im or message.channels events. Every Slack message will send a POST request to this URL.

  3. Filter bot messages

    The 'Is user message?' node checks if $json.body.event.bot_id does not exist (notExists). If bot_id exists, it's a bot message: take the false branch to 'No Operation, do nothing' and stop. If not, it's a user message: proceed to AI Agent. This prevents loops from bot/self-messages.

  4. Configure AI Agent and sub-nodes

    The AI Agent node is the core processor, connecting four sub-nodes: 1) OpenAI Chat Model: select gpt-4o-mini, bind openAiApi credential; 2) Simple Memory: sessionKey set to {{ $('Webhook').first().json.body.event.channel }}__gilfoyle, contextWindowLength 30, isolating conversation history by channel ID; 3) SerpAPI: bind serpApi credential as search tool; 4) Wikipedia: as encyclopedia lookup tool. In AI Agent Options → System Message, enter the system prompt defining bot persona and response style. The AI Agent Text field is pre-filled with {{ $json.body.event.text }}, automatically reading user message content.

    Execution prompt · Source text。AI Agent node Options → System Message field

    You are Gilfoyle from Silicon Valley TV show. Amplify your bluntness and cynicism, tolerating zero incompetence. Be openly contemptuous when answering questions, and cut straight to the point with minimal regard for others' feelings. Your sarcasm should be razor-sharp, and humor should take a backseat to delivering cutting remarks.\nDo your best to answer the questions. Feel free to use any tools available to look up relevant information, only if necessary.
  5. Configure Slack output node

    The Slack node receives AI Agent output and sends the reply back. Parameters: Select set to user; User set to {{ $('Webhook').first().json.body.event.user }}, targeting the original sender; Text set to {{ $json.output }}, the AI Agent generated content. Bind slackApi credential. Save and activate the workflow, then send a message to the bot in Slack to trigger the full flow.

Prompt you can copy

Setup guidance · Editorial suggestion。Give to setup assistant; confirm inputs and permissions first

This block is the prompt. Ads are never placed here.

You are an n8n workflow setup assistant. The user wants to replicate the 'Slack chatbot powered by AI' template. First confirm they have: n8n 1.19.4+ instance, OpenAI API key, Slack API credentials, SerpAPI credentials (optional). Then guide them to import the template, configure the Webhook URL in Slack Event Subscriptions, check the system prompt in AI Agent, bind credentials for each node, and finally test message sending/receiving.

Before setup, ensure your Slack App has Event Subscriptions enabled and subscribes to message events

Source

Slack chatbot powered by AI · n8n-team · n8n.io · 2023-10-03

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related