Run Qwen Code AI from Slack on your own machine

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.

View on GitHub


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)"
  • Windows: download the LTS installer from nodejs.org and install it
  • Verify:
    • node --version
    • Should show v20.x.x or 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.x or newer

Step 5: Create a Slack app

Go to api.slack.com/apps.

  1. Create App: choose “From scratch”, name it QwenCode, and select your workspace.
  2. Enable Socket Mode:
    • Create a token named qwen-bot
    • Copy the xapp- token to SLACK_APP_TOKEN
  3. Add bot scopes under OAuth & Permissions:
    • app_mentions:read
    • chat:write
    • im:history
    • im:read
    • im:write
    • reactions:read
    • reactions:write
    • users:read
  4. Enable Event Subscriptions:
    • Subscribe to app_mention
    • Subscribe to message.im
  5. App Home:
    • Enable “Messages Tab”
    • Allow users to send messages
  6. Install the app
    • Copy the xoxb- token to SLACK_BOT_TOKEN

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 QwenCode in Slack DMs
  • Mention the bot in a channel: /invite @QwenCode, then tag it
  • Same thread = same context
  • New thread = new conversation

Troubleshooting

ProblemFix
qwen: command not foundRestart the terminal or reinstall via npm
node: command not foundInstall Node.js (Step 1)
Bot not respondingEnable “Messages Tab” in Slack App Home
Auth expiredRun qwen again
Timeout errorsSet 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.

Frequently asked questions

No. The bot uses Slack Socket Mode, so it keeps a WebSocket connection from your computer to Slack instead of requiring a public webhook.