One-command deployment of OpenClaw AI agent with n8n workflow automation on Digital Ocean.
- OpenClaw - AI agent accessible via Telegram
- n8n - Workflow automation with web UI
- Caddy - Automatic HTTPS
- PostgreSQL - Database for n8n
- Redis - Queue for n8n workers
Internet
│
├─── Telegram ──────────► OpenClaw (internal only)
│ │
│ ▼
└─── HTTPS ──► Caddy ──► n8n ◄─┘
│
▼
PostgreSQL + Redis (internal)
Security:
- OpenClaw is NOT exposed to the internet (only accessible internally)
- n8n webhooks protected with header authentication
- PostgreSQL/Redis on isolated internal network
- Digital Ocean Droplet - Ubuntu 24.04, 2GB+ RAM recommended
- Telegram Bot Token - Get from @BotFather
- Telegram User ID - Get from @userinfobot
- OpenAI API Key - Get from OpenAI
SSH into your droplet and run:
curl -sL https://raw.githubusercontent.com/Barty-Bart/openclaw-n8n-starter/main/setup.sh -o setup.sh
chmod +x setup.sh
./setup.shThe script will ask for:
- Telegram Bot Token
- Telegram User ID
- OpenAI API Key
- Droplet IP (auto-detected)
- Access n8n:
https://n8n.YOUR_IP.nip.io - Message your Telegram bot to start chatting with OpenClaw
- Create workflows in n8n that OpenClaw can trigger
OpenClaw has an n8n-webhook skill. Ask it to trigger your workflow and it will call the webhook.
In n8n, create a Webhook node with:
- Authentication: Header Auth
- Header Name:
X-Webhook-Secret - Header Value: (shown after install)
Use HTTP Request node in n8n:
- URL:
http://openclaw-gateway:18789/tools/invoke - Method: POST
- Headers:
Authorization:Bearer YOUR_GATEWAY_TOKENContent-Type:application/json
- Body:
{
"tool": "sessions_send",
"args": {
"sessionKey": "agent:main:main",
"message": "Hello from n8n!",
"timeoutSeconds": 0
}
}# View logs
cd /opt/openclaw
docker compose logs -f
# Restart services
docker compose restart
# Stop everything
docker compose down
# Start everything
docker compose up -d
# Check OpenClaw skills
docker compose run --rm openclaw-cli skills listBot not responding?
docker compose logs openclaw-gatewayn8n not loading?
docker compose logs caddy
docker compose logs n8nWebhook not working?
- Check the webhook path matches
- Check the X-Webhook-Secret header is correct
- Use internal URL:
http://n8n:5678/webhook/...
Use at your own risk. I've tried to make this secure, but it is NOT 100% perfect.
This is great for testing and learning. For production use, you'll need to do additional security hardening yourself.
I'm not responsible for any issues, data loss, security breaches, etc.