Tools: How to Build Your Own Local AI Agent: Setting Up OpenClaw with Ollama and Slack on Ubuntu
Prerequisites
Step 1: Install the "Brain" (Ollama)
Step 2: Install the "Agent" (OpenClaw)
Step 3: Create the "Interface" (Slack App)
Step 4: Connecting Everything
Success! Imagine having a personal assistant that lives on your computer, respects your privacy, costs $0 in subscription fees, and chats with you directly through Slack. Ollama allows your computer to run powerful AI models (like Llama 3 or Qwen) locally so your data never leaves your machine. curl -fsSL https://ollama.com | sh ollama pull qwen2.5-coder:7b OpenClaw is the "body" of your assistant. It takes your Slack messages, asks the AI brain what to do, and performs tasks like searching files or the web. curl -fsSL https://openclaw.ai | bash openclaw onboard --install-daemon Follow the prompts: Select Manual and Local when asked. openclaw gateway start To talk to your agent, you need to create a "bot" in Slack. Now, tell OpenClaw how to talk to Slack and Ollama. openclaw config set channels.slack.enabled true openclaw config set channels.slack.appToken "YOUR_XAPP_TOKEN" openclaw config set channels.slack.botToken "YOUR_XOXB_TOKEN" openclaw config set provider.type "ollama" openclaw config set provider.model "qwen2.5-coder:7b" openclaw gateway restart Your local AI agent is now live. You can ask it to write code, summarize text, or (once you install more "skills" from the OpenClaw dashboard) manage your calendar and files. Templates let you quickly answer FAQs or store snippets for re-use. as well , this person and/or - A computer running Ubuntu (20.04 or newer).
- A Slack workspace where you have permission to add apps.- Basic comfort with the Terminal (Ctrl+Alt+T). - Run the Installer: Open your terminal and paste this command: - Download a Model: We’ll use qwen2.5-coder, which is excellent at following instructions and using tools. - Install Dependencies: OpenClaw needs Node.js. The easiest way is the official script: - Run Onboarding: This command sets up the background services. - Start the Gateway: - Create App: Go to Slack API Dashboard → Create New App → From Scratch. Name it "MyAI" and pick your workspace.- Enable Socket Mode: This allows the bot to work without complex networking.- In the left sidebar, click Socket Mode → Toggle Enable. Give the token a name (e.g., "OpenClawToken") and click Generate.Copy the token (starts with xapp-).- Give the token a name (e.g., "OpenClawToken") and click Generate.- Copy the token (starts with xapp-).- Permissions (Scopes):- Go to OAuth & Permissions. Scroll to Bot Token Scopes and add: app_mentions:read, chat:write, im:history, and im:read.Scroll up and click Install to Workspace.Copy the Bot User OAuth Token (starts with xoxb-).- Scroll to Bot Token Scopes and add: app_mentions:read, chat:write, im:history, and im:read.- Scroll up and click Install to Workspace.- Copy the Bot User OAuth Token (starts with xoxb-).- Go to Event Subscriptions → Toggle On. Under "Subscribe to bot events," add app_mention and message.im. Click Save Changes.- Under "Subscribe to bot events," add app_mention and message.im. Click Save Changes. - Give the token a name (e.g., "OpenClawToken") and click Generate.- Copy the token (starts with xapp-). - Scroll to Bot Token Scopes and add: app_mentions:read, chat:write, im:history, and im:read.- Scroll up and click Install to Workspace.- Copy the Bot User OAuth Token (starts with xoxb-). - Under "Subscribe to bot events," add app_mention and message.im. Click Save Changes. - Configure Tokens: Replace the placeholders below with your actual tokens from Step 3: - Connect Ollama: Tell OpenClaw to use your local AI model. - Restart & Pair: - The Final Handshake:- Open Slack and find your new bot under "Apps." Send it a message like "Hello."The bot will reply with a Pairing Code.Go back to your Ubuntu terminal and type:openclaw pairing approve slack- Send it a message like "Hello."- The bot will reply with a Pairing Code.- Go back to your Ubuntu terminal and type:openclaw pairing approve slack - Send it a message like "Hello."- The bot will reply with a Pairing Code.- Go back to your Ubuntu terminal and type:openclaw pairing approve slack