# Create a Slack AI chatbot with OpenRouter and Postgres: n8n workflow

> Started by an event in a connected app, and works across Slack. It puts OpenRouter behind a retrieval step, so answers are drawn from documents you supply...

Source: https://millionrounds.com/workflow/create-a-slack-ai-chatbot-with-openrouter-and-postgres (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Content](https://millionrounds.com/workflows?category=Content#library)

# Create a Slack AI chatbot with OpenRouter and Postgres

Started by an event in a connected app, and works across Slack. It puts OpenRouter behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 8 steps, 1 branch: small enough to read in one sitting and change without fear.

Small Calls a model: OpenRouter Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcreate-a-slack-ai-chatbot-with-openrouter-and-postgres)

**8 steps** Small: readable in one sitting

**1** Branch: places the flow splits

**0** Loops or waits

**1** Service it connects to

## The flow

Starts it 1 Model 3 Logic 2 Service 2

The steps in the order they run, from what starts it.

- 1 **OpenRouter Chat Model** Lm Chat Open Router *Model*
- 2 **On Message Received** Slack trigger *Starts it*
- 3 **Postgres Chat Memory** Memory Postgres Chat *Model*
- 4 **AI Agent** Agent *Model*
- 5 **Check If User** If *Logic*
- 6 **Send Reply** Slack *Service*
- 7 **Set Thinking Status** Http Request *Service*
- 8 **NoOp** No Op *Logic*

## How it's built

- **Starts on:** An event in a connected app
- **Steps:** 8, with 1 branch
- **Size:** Small: readable in one sitting
- **Connects to:** Slack
- **Model:** OpenRouter
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Slack account, and a key for OpenRouter. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an event in a connected app.

Does it use AI?

Yes. It calls OpenRouter. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Not long. At 8 steps it can be read in one sitting and changed without fear.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 8 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fcreate-a-slack-ai-chatbot-with-openrouter-and-postgres)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Slack](https://millionrounds.com/workflows?service=Slack#library)

## Workflows like it

Also content, with the same services where possible, closest in size first.

- [**Automated travel news audio digest with Groq and Google Sheets** 8 steps · calls a model · Google Sheets, RSS](https://millionrounds.com/workflow/automated-travel-news-audio-digest-with-groq-and-google-shee)
- [**Daily business news briefings with NewsAPI and OpenAI** 8 steps · calls a model · Slack](https://millionrounds.com/workflow/daily-business-news-briefings-with-newsapi-and-openai)
- [**Filter TikTok real estate videos for couples with Apify** 8 steps · calls a model · Apify, Google Sheets](https://millionrounds.com/workflow/filter-tiktok-real-estate-videos-for-couples-with-apify)
- [**Find viral AI content topics with Google Sheets** 8 steps · calls a model · Gmail, Slack](https://millionrounds.com/workflow/find-viral-ai-content-topics-with-google-sheets)
- [**YouTube video summaries with OpenAI and Slack** 8 steps · calls a model · Google Sheets, RSS](https://millionrounds.com/workflow/youtube-video-summaries-with-openai-and-slack)
- [**YouTube video summary to Discord with OpenAI and Slack** 8 steps · calls a model · Discord, Google Sheets](https://millionrounds.com/workflow/youtube-video-summary-to-discord-with-openai-and-slack)
