Posted: 4/11/2026 | Updated: April 11, 2026
Talk to Qwen Code AI from Slack using a local bot. This setup keeps the bot on your computer, connects through Slack Socket Mode, and avoids any public server, Cloudflare tunnel, or recurring hosting cost.
This guide works with either the original repo or the fork, but it points to Fr0z3nRebel/qwen-code-slack because that fork includes a patch to prevent duplicate bot responses. The upstream project is yashaiguy-dev/qwen-code-slack.
Overview
This bot connects Qwen Code to Slack and runs locally on your machine. It handles DMs and @mentions in channels, and every Slack thread keeps its own context.
That means:
- No external server to host
- No public webhook URL
- No monthly hosting bill
- Thread-level memory for conversations
- It uses Qwen’s free tier, which resets daily, so you can keep using it without additional costs
- You get a practical local Slack workflow without paying for hosted bot infrastructure
What you need
- A Mac or Windows computer
- A Slack workspace where you can create an app
- About 15 minutes to set it up
Step 1: Install Node.js
Qwen Code requires Node.js.
- Mac:
brew install node- If Homebrew is missing:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- If Homebrew is missing:
- Windows: download the LTS installer from nodejs.org and install it
- Verify:
node --version- Should show
v20.x.xor newer
Step 2: Install Qwen Code
- Mac / Linux:
bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)"
- Windows (Admin Command Prompt):
curl -fsSL -o %TEMP%\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat && %TEMP%\install-qwen.bat
- Alternative:
npm install -g @qwen-code/qwen-code@latest
Verify with:
qwen --version
Step 3: Log into Qwen
Run qwen in your terminal. A browser window opens and lets you sign in or sign up at qwen.ai. After login, return to the terminal and press Ctrl + C.
Test headless mode:
qwen -p "say hello" --output-format stream-json
If you see JSON output, Qwen is working.
Step 4: Install Python
- Mac:
brew install python3 - Windows: download Python from python.org and make sure “Add Python to PATH” is checked
- Verify:
python3 --version- Should be
3.10.xor newer
Step 5: Create a Slack app
Go to api.slack.com/apps.
- Create App: choose “From scratch”, name it
QwenCode, and select your workspace. - Enable Socket Mode:
- Create a token named
qwen-bot - Copy the
xapp-token toSLACK_APP_TOKEN
- Create a token named
- Add bot scopes under OAuth & Permissions:
app_mentions:readchat:writeim:historyim:readim:writereactions:readreactions:writeusers:read
- Enable Event Subscriptions:
- Subscribe to
app_mention - Subscribe to
message.im
- Subscribe to
- App Home:
- Enable “Messages Tab”
- Allow users to send messages
- Install the app
- Copy the
xoxb-token toSLACK_BOT_TOKEN
- Copy the
Step 6: Download and configure the bot
git clone https://github.com/Fr0z3nRebel/qwen-code-slack.git
cd qwen-code-slack
pip3 install -r requirements.txt
cp .env.example .env
Edit .env and add your Slack tokens. Set QWEN_WORK_DIR to the folder you want the bot to access. This guide uses the fork above because it includes a patch that prevents duplicate AI responses in Slack threads.
Step 7: Run the bot
Start it with:
python3 bot.py
Keep that terminal open while the bot is running.
How to use it
- DM the bot: find
QwenCodein Slack DMs - Mention the bot in a channel:
/invite @QwenCode, then tag it - Same thread = same context
- New thread = new conversation
Troubleshooting
| Problem | Fix |
|---|---|
qwen: command not found | Restart the terminal or reinstall via npm |
node: command not found | Install Node.js (Step 1) |
| Bot not responding | Enable “Messages Tab” in Slack App Home |
| Auth expired | Run qwen again |
| Timeout errors | Set QWEN_TIMEOUT=600 in .env |
Notes
This setup keeps the bot local and avoids hosting a server or opening a public endpoint. It is best for quick, private Slack access to Qwen Code AI without extra infrastructure.