Skip to main content

Create a Slack AI chatbot with threads & thinking UI using OpenRouter & Postgres

Workflow preview

Workflow preview
100%
Create a Slack AI chatbot with threads & thinking UI using OpenRouter & Postgres preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Slack quietly released an update to their API that allows developers to build "AI Apps & Agents", which is a special classification of apps that have access to several special capabilities includin...

Best for

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

Tools used

@n8n/n8n-nodes-langchain.lmchatopenrouter, @n8n/n8n-nodes-langchain.agent, n8n-nodes-base.noop, n8n-nodes-base.slacktrigger, n8n-nodes-base.if, n8n-nodes-base.httprequest, n8n-nodes-base.slack, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by James Francis.

Original n8n.io source

1.1 Workflow description

Title
Create a Slack AI chatbot with threads & thinking UI using OpenRouter & Postgres
Workflow name
Create a Slack AI chatbot with threads & thinking UI using OpenRouter & Postgres

Overview

Slack quietly released an update to their API that allows developers to build "AI Apps & Agents", which is a special classification of apps that have access to several special capabilities including:

  • Multiple simultaneous chat threads with one user
  • Loading "three dots" UI while your agent is thinking
  • Option for users to pin your app to their top bar for quick chat access

This workflow demonstrates how to build a Slack agent that takes advantage of all of these features.

For a full video walkthrough of this workflow, watch this YouTube tutorial.

Setup Instructions

All of the below steps are required for this workflow to function properly unless otherwise noted.

Create a Slack App

  1. Visit api.slack.com and click "Your Apps"
  2. Create a new app from scratch and follow the setup instructions
  3. In the Agents & AI Apps tab, enable the toggle and give your app a brief description
  4. In the OAuth & Permissions tab, enable the following bot token scopes:
    1. assistant:write
    2. chat:write
    3. channels:read
    4. im:history
  5. Install the app into your workspace and grant the requested permissions
  6. In your Slack workspace, right click your app's name in the sidebar, click "View app details", and make note of your apps Channel ID - you'll need this later.
  7. Copy your app's Bot User OAuth Token - you'll need that to create your n8n credentials
  8. In the Event Subscriptions tab, enable events and paste the workflows PRODUCTION webhook url (from this workflow's trigger node) into the input.
  9. In the same tab under "Susbcribe to bot events", select message.im

Create a Postgres database

In order to save the chat history and give your agent a working memory, you'll need your own Postgres database. You can use Supabase, Neon, or any other Postgres database provider. Once you've added your database's credentials to n8n, you can select those credentials in the Postgres Chat Memory node. This worklow saves all chat history in a table called chat_histories, but you name the table whatever you want.

Create n8n Credentials

You'll need to create the following credentials:

  1. Slack API. Use your Bot User OAuth Token referenced above.
  2. Bearer Auth. Use the same Bot User OAuth Token.
  3. Postgres. Use the connection string or config from your database provider.
  4. OpenRouter (or any other LLM model for the agent's model node)

Wire Everything Up

Now that you've created your Slack app, have your Postgres database, and have created credentials, follow these steps to wire up your workflow:

  1. In the "On Message Received" trigger, use your Slack API credential and enter your apps Channel ID in the "Channel To Watch" field.
  2. In the "Set Thinking Status" node, use your Bearer Auth credential.
  3. In the "Postgres Chat Memory" node, use your Postgres credential.
  4. In the "Send Reply" node, use your Slack API credential.

Using the Chatbot

Once you've completed the setup process and added in your credentials, you'll have a fully functional Slack chatbot complete with threads, loading UI, and the ability to pin your app to your workspace's top bar.

Taking the Next Steps

Now that this skeleton app is in place, it's up to you to add horsepower to the AI agent at the center of it all. Customize the prompts and add whatever tools you'd like. The sky is the limit!

If you have any questions or feedback about this workflow, or would like me to build custom workflows for your business, email me at [email protected].

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 - OpenRouter Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 2 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2

Block 3 - NoOp

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

Block 4 - On Message Received

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

Block 5 - Check If User

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

Block 6 - Set Thinking Status

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 7 - Send Reply

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 8 - Sticky Note

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

Block 9 - Sticky Note1

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

Block 10 - Sticky Note2

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

Block 11 - Sticky Note3

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

Block 12 - Postgres Chat Memory

Type / Role
@n8n/n8n-nodes-langchain.memoryPostgresChat - memoryPostgresChat
Config choices
Version 1.3

3. Summary Table

Workflow Create a Slack AI chatbot with threads & thinking UI using OpenRouter & Postgres
Complexity intermediate
Nodes 12
Categories Support Chatbot, AI Chatbot
Author James Francis
Published 07 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5749/5749.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 Slack AI chatbot with threads & thinking UI using OpenRouter & Postgres do?

Slack quietly released an update to their API that allows developers to build "AI Apps & Agents", which is a special classification of apps that have access to several special capabilities includin...

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 Chatbot use case.