TUTORIAL

OpenClaw Tutorial: Getting Started in 30 Minutes

Your first AI agent, from zero to automation in half an hour

This tutorial walks you through setting up OpenClaw and creating your first automation. By the end, you'll have an AI agent that can read emails and draft responses automatically.

What You'll Build

  • ✓ OpenClaw instance running on your server
  • ✓ Gmail integration for email processing
  • ✓ AI agent that drafts email responses
  • ✓ Slack notifications for important emails

Prerequisites

What You Need

  • • A Linux server (Ubuntu 22.04 LTS recommended)
  • • 4GB RAM, 2 CPU cores minimum
  • • Basic command line familiarity
  • • Node.js 18+ and NPM installed
  • • SSH access to your server

Recommended Server Providers

ProviderPlanCost
HetznerCPX11 (4GB RAM)~$6/month
DigitalOceanBasic (4GB RAM)$24/month
LinodeShared (4GB RAM)$24/month

Step 1: Provision Your Server (5 minutes)

Option A: Hetzner Cloud (Recommended)

  1. Sign up at hetzner.com/cloud
  2. Create a new project
  3. Click "Add Server"
  4. Choose: Location closest to you, Image: Ubuntu 22.04, Type: CPX11 (2 vCPU, 4GB RAM)
  5. Add your SSH key
  6. Name it "openclaw-server" and create

Option B: DigitalOcean

  1. Sign up at digitalocean.com
  2. Create Droplet → Basic → Regular Intel with SSD
  3. $24/month plan (4GB RAM)
  4. Choose datacenter region
  5. Select Ubuntu 22.04
  6. Add SSH key and create

Step 2: Connect to Your Server (2 minutes)

Open your terminal and SSH into the server:

# Replace with your server's IP address
ssh root@YOUR_SERVER_IP

# Update the system
apt update && apt upgrade -y

Step 3: Install Dependencies (3 minutes)

# Install Node.js 20
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs

# Verify installation
node --version  # Should show v20.x.x
npm --version   # Should show 10.x.x

# Install Git
apt-get install -y git

# Install build tools
apt-get install -y build-essential

Step 4: Install OpenClaw (5 minutes)

# Create directory
mkdir -p /opt/openclaw && cd /opt/openclaw

# Clone OpenClaw
git clone https://github.com/openclaw/openclaw.git .

# Install dependencies
npm install

# Build the project
npm run build

# Create config directory
mkdir -p ~/.config/openclaw

Step 5: Configure OpenClaw (5 minutes)

Create your configuration file:

# Create config file
nano ~/.config/openclaw/config.yaml

Add this basic configuration:

# Basic OpenClaw Configuration
gateway:
  port: 8080
  host: 0.0.0.0

# AI Provider (choose one)
ai:
  provider: anthropic
  model: claude-3-sonnet-20240229
  apiKey: YOUR_ANTHROPIC_API_KEY

# Or use OpenAI:
# ai:
#   provider: openai
#   model: gpt-4
#   apiKey: YOUR_OPENAI_API_KEY

# Memory
memory:
  enabled: true
  path: ~/.config/openclaw/memory

# Logging
log:
  level: info
  file: ~/.config/openclaw/openclaw.log

Get Your API Key

Step 6: Start OpenClaw (2 minutes)

# Start OpenClaw
npm start

# You should see:
# [Gateway] Server listening on http://0.0.0.0:8080
# [AI] Connected to provider: anthropic

Press Ctrl+C to stop for now. We'll set up a proper service next.

Step 7: Create a Systemd Service (3 minutes)

To keep OpenClaw running after you disconnect:

# Create service file
nano /etc/systemd/system/openclaw.service

Add this content:

[Unit]
Description=OpenClaw AI Agent
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/opt/openclaw
ExecStart=/usr/bin/npm start
Restart=always
RestartSec=10
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

Enable and start the service:

# Reload systemd
systemctl daemon-reload

# Enable service (starts on boot)
systemctl enable openclaw

# Start service now
systemctl start openclaw

# Check status
systemctl status openclaw

Step 8: Connect Telegram (3 minutes)

Let's add your first integration—Telegram for easy control.

  1. Message @BotFather on Telegram
  2. Type /newbot
  3. Name your bot (e.g., "MyOpenClaw")
  4. Choose a username (e.g., "myopenclaw_bot")
  5. Copy the API token (looks like: 123456789:ABCdef...)

Add Telegram to your config:

# Edit config
nano ~/.config/openclaw/config.yaml

# Add at the bottom:
channels:
  telegram:
    enabled: true
    botToken: YOUR_TELEGRAM_BOT_TOKEN
    allowedUsers: []  # Leave empty to allow all, or add your Telegram ID

# Restart OpenClaw
systemctl restart openclaw

Now message your bot on Telegram—it should respond!

Troubleshooting

OpenClaw won't start

Check logs:

journalctl -u openclaw -f

Common issues:

  • Missing API key
  • Port 8080 already in use
  • Permission issues on /opt/openclaw
Telegram bot not responding
  • Verify bot token is correct
  • Make sure you started a conversation with the bot
  • Check OpenClaw logs for errors

What's Next?

You now have a working OpenClaw setup! Here are ways to expand:

  • Gmail integration: Add email processing skills
  • Slack integration: Connect to your team workspace
  • Calendar skills: Enable meeting prep and scheduling
  • Custom skills: Write your own for specific tasks

Need Help With Setup?

This tutorial gets you started, but production setups need more: security hardening, backup systems, SSL certificates, and custom skills.

Get Professional Setup ($25) →