Build an AI Data Analyst Inside Slack
How to build a data AI analyst inside Slack using Bag of words.
If youâve ever tried getting quick answers from your data, you know the drill: switch tabs, open a dashboard, remember which filter does what, export to CSV, maybe ping someone on the data team. Itâs slow and annoying.
Your team already lives in Slack. So why not just ask your database questions there?
Thatâs what this guide is about. Weâre going to hook up Slack to Bag of Words so you can DM a bot with questions like âshow churn rate by plan tier over last 6 monthsâ and get back actual answers with charts.

Hereâs what happens: you ask a question in plain English, the LLM converts it to SQL, runs it against your actual database, and sends back the result. All in Slack. Auth and audit logs included.
How It Works
Itâs pretty simple. Bag of Words connects to your database and handles all the LLM stuff. Then we wire up Slack to talk to Bag of Words. Thatâs it.

Step 0: Deploy Bag of Words
First, get Bag of Words running. You can spin it up with Docker or Helm â full instructions at docs.bagofwords.com/install.
Once itâs up, log in, add an LLM, connect your database, and create your admin account. If you can ask questions in the web UI and get answers back, youâre good.
Step 1: Add an LLM
Go to Settings â LLM Provider â Add Key and plug in your API key. Works with OpenAI, Anthropic, or whatever else youâre using. This is what translates âshow me revenueâ into actual SQL.
Step 2: Connect Your Database
Head to Data Sources and pick yours â Postgres, MySQL, BigQuery, Snowflake, Salesforce, AWS Cost Explorer, whatever.
Try asking something like "total active users by week for last 90 days". If it works, youâre set.
Step 3: Set up the Slack Integration
Now we need to create a Slack app and connect it to Bag of Words.
Go to api.slack.com/apps and click âCreate New App from Scratchâ. Name it something like Data Assistant and pick your workspace.
Add Permissions
Under OAuth & Permissions, add these Bot Token Scopes:
app_mentions:read
channels:read
chat:write
files:read
files:write
im:history
im:read
im:write
reactions:read
users:read
users:read.email
Hit âInstall to Workspaceâ and grab your Bot Token (the one that starts with xoxb-).
Set Up the Webhook
Go to Event Subscriptions and turn it on. For the Request URL, use:
https://your-bagofwords-url.com/api/settings/integrations/slack/webhook
Add the message.im event so your bot can actually read DMs.
Get Your Signing Secret
Under Basic Information, copy the Signing Secret.
Connect Everything
Back in Bag of Words, go to Settings â Integrations â Slack â Connect. Paste in your Bot Token and Signing Secret.

Hit âConnectâ and youâre done with setup.
Step 4: User Authentication
For security (because this is real data), people need to be Bag of Words users. When someone DMs the bot for the first time, theyâll be asked to log in. After that, they can just ask questions.
Step 5: Actually Use It
Thatâs it. Now anyone on your team can DM the bot:
> "weekly signup count by channel since March"
> "top 10 pages by bounce rate"
> "generate csv of sales by product line, Q1"
They get back answers, charts, CSV files, and a link to the saved report.
Why bother with this? Because context switching kills momentum. Opening a BI tool, finding the right dashboard, remembering how filters work â it takes time and most people just give up.
With this setup, data is where conversations already happen. Someone asks a question in a thread, you can reply with actual numbers without leaving Slack.
Thatâs the whole point. Less friction, faster answers, same security.
If you have thoughts or want to contribute, weâre on GitHub.