DEV Community

Chishan
Chishan

Posted on

How to Run Your Own AI Assistant Across WhatsApp, Telegram, and Discord

How to Run Your Own AI Assistant Across WhatsApp, Telegram, and Discord

Most people interact with AI through a web browser. You open ChatGPT, type a question, get a response, and move on. But what if your AI assistant lived inside the apps you already use — WhatsApp, Telegram, Discord, Slack, even iMessage?

That's the idea behind OpenClaw, an open-source project that connects Claude AI to your everyday messaging apps. You run it on your own machine, you control the data, and you talk to it wherever you already communicate.

I spent a weekend setting it up. Here's what I learned.

Why Self-Hosted?

Before diving into the setup, let's address the obvious question: why bother running your own AI assistant when ChatGPT exists?

Three reasons stood out to me:

  1. Data stays on your hardware. Every conversation goes through your machine. Nothing gets stored on a third-party server you don't control.

  2. Multi-channel access. Instead of switching between apps, the same assistant is available on WhatsApp for personal messages, Slack for work, and Discord for community projects.

  3. Customization. OpenClaw supports hooks, plugins, and custom tools. You can build workflows that trigger based on specific messages or automate repetitive tasks.

Prerequisites

Before starting, make sure you have:

  • A machine running macOS, Linux, or Windows (macOS is the smoothest experience)
  • Node.js 18+ installed
  • An Anthropic API key (for Claude access)
  • Admin access to create bots on your target messaging platforms

Installation: The 60-Second Version

OpenClaw's installation is straightforward if you're comfortable with a terminal:

# Clone the repository
git clone https://github.com/openclaw/openclaw.git
cd openclaw

# Install dependencies
npm install

# Copy the example config
cp .env.example .env
Enter fullscreen mode Exit fullscreen mode

Edit .env to add your Anthropic API key:

ANTHROPIC_API_KEY=sk-ant-your-key-here
Enter fullscreen mode Exit fullscreen mode

Then start the server:

npm start
Enter fullscreen mode Exit fullscreen mode

That's it for the base installation. OpenClaw runs a local gateway that handles routing messages between your messaging platforms and Claude.

Connecting Your First Channel: Telegram

Telegram is the easiest channel to set up, so it's a good starting point.

Step 1: Create a Telegram Bot

Open Telegram, search for @BotFather, and send /newbot. Follow the prompts to name your bot and get a bot token.

Step 2: Configure OpenClaw

Add the token to your .env:

TELEGRAM_BOT_TOKEN=your-bot-token-here
TELEGRAM_ENABLED=true
Enter fullscreen mode Exit fullscreen mode

Step 3: Restart and Test

npm start
Enter fullscreen mode Exit fullscreen mode

Send a message to your new bot in Telegram. You should get a Claude-powered response within seconds.

Adding WhatsApp

WhatsApp requires a few more steps because of Meta's Business API requirements. OpenClaw uses the WhatsApp Web protocol, which means:

  1. You'll scan a QR code on first connection (similar to WhatsApp Web)
  2. The session persists across restarts
  3. You can use your existing WhatsApp number
# Enable WhatsApp in .env
WHATSAPP_ENABLED=true
Enter fullscreen mode Exit fullscreen mode

On first startup with WhatsApp enabled, you'll see a QR code in your terminal. Scan it with your phone's WhatsApp app (Settings → Linked Devices → Link a Device).

Once linked, any message sent to your WhatsApp number that mentions the bot's trigger word will get a response.

Discord Integration

For Discord, you need to create a bot application:

  1. Go to the Discord Developer Portal
  2. Create a new application
  3. Navigate to the Bot section and copy the token
  4. Invite the bot to your server using the OAuth2 URL generator
DISCORD_BOT_TOKEN=your-discord-token
DISCORD_ENABLED=true
Enter fullscreen mode Exit fullscreen mode

The Discord integration supports both direct messages and channel mentions. In channels, prefix your message with the bot's mention to trigger a response.

Multi-Channel in Practice

Here's where things get interesting. Once you have multiple channels connected, you effectively have a unified AI assistant that follows you across platforms.

Some practical use cases I've found:

  • Morning briefing via WhatsApp: Ask for a summary of your calendar and weather
  • Code review on Discord: Paste code snippets in a dev channel and get instant feedback
  • Quick research on Telegram: Forward articles to the bot for summaries while commuting
  • Work tasks on Slack: Draft emails, summarize meeting notes, brainstorm ideas

The assistant maintains context within each channel's conversation, so you can have ongoing discussions without repeating yourself.

Extending with Hooks and Plugins

OpenClaw becomes more powerful when you customize it. The hooks system lets you intercept and modify messages before they reach Claude:

// hooks/profanity-filter.js
export default {
  name: 'profanity-filter',
  before: async (message) => {
    if (containsProfanity(message.content)) {
      return { ...message, content: '[filtered]' };
    }
    return message;
  }
};
Enter fullscreen mode Exit fullscreen mode

Plugins extend functionality with new capabilities:

// plugins/weather.js
export default {
  name: 'weather',
  description: 'Get current weather for a location',
  execute: async ({ location }) => {
    const data = await fetchWeather(location);
    return `Current weather in ${location}: ${data.temp}°C, ${data.condition}`;
  }
};
Enter fullscreen mode Exit fullscreen mode

Once registered, Claude can call these plugins when relevant. Ask "What's the weather in Tokyo?" and the weather plugin handles the API call.

What About Non-Technical Users?

The terminal-based setup works for developers, but what about everyone else?

The OpenClaw deployment guide walks through each step with screenshots and troubleshooting tips. It covers common issues like port conflicts, API key formatting, and platform-specific quirks.

For those who want a managed experience without terminal commands, DesktopClaw offers a desktop application that handles the deployment automatically. You install the app, enter your API key, connect your channels through a GUI, and you're done.

Performance and Resource Usage

Running on a 2023 MacBook Air (M2, 8GB RAM):

Metric Value
Memory usage (idle) ~120MB
Memory usage (active conversation) ~180MB
Response latency (Telegram) 1-3 seconds
Response latency (WhatsApp) 2-4 seconds
CPU usage (idle) <1%

The gateway itself is lightweight. Most of the processing happens on Anthropic's servers through the API. Your machine mainly handles message routing and plugin execution.

Troubleshooting Common Issues

"Connection refused" on WhatsApp: The WhatsApp Web session expires after ~14 days of inactivity. Re-scan the QR code to reconnect.

Discord bot not responding in channels: Make sure the bot has "Message Content Intent" enabled in the Developer Portal under Bot → Privileged Gateway Intents.

Slow responses: Check your API key tier. Free-tier Anthropic keys have lower rate limits. Also verify your internet connection — latency to Anthropic's API servers affects response time.

Multiple channels interfering: Each channel runs independently. If one channel crashes, others continue working. Check logs with npm run logs to identify the problematic channel.

Security Considerations

Since you're running this on your own infrastructure:

  • API keys: Store them in .env, never commit them to version control
  • Network exposure: By default, the gateway only listens on localhost. Use a reverse proxy (nginx, Caddy) if you need remote access
  • Message logging: OpenClaw doesn't log message content by default. Enable logging explicitly if you need it for debugging
  • Platform tokens: Rotate your bot tokens periodically, especially the WhatsApp session

The security configuration guide covers these topics in more detail, including SSL setup and access control.

What's Next

OpenClaw is actively developed and the roadmap includes:

  • Voice message support (Speech-to-Text → Claude → Text-to-Speech)
  • Image understanding via Claude's vision capabilities
  • Group chat mode where the bot participates in multi-person conversations
  • Scheduled messages and reminders

Wrapping Up

Running a self-hosted AI assistant across multiple messaging platforms sounded complicated at first. In practice, the core setup takes about 30 minutes, and connecting additional channels takes 5-10 minutes each.

The value becomes clear once you stop context-switching between apps to talk to an AI. Having Claude available in the same threads where you already communicate changes how you interact with it — from a deliberate tool you open to an ambient resource that's always there.

If you're interested, the OpenClaw documentation covers the full setup process, platform-specific guides for all 8 supported channels, and advanced configuration for hooks and plugins.


Have you tried running a self-hosted AI assistant? What channels do you use it on? Share your setup in the comments.


Follow me for more posts on self-hosted AI tools and practical LLM applications.

Top comments (0)