Permanent webhook + Cloudflare tunnel setup (20 min)
pkill cloudflared
cloudflared tunnel create minnie-webhook
Output will show:
Created tunnel minnie-webhook with id XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Copy that tunnel ID - you'll need it in Step 4
mkdir -p ~/.cloudflared
# Replace TUNNEL_ID with the ID from Step 2
cat > ~/.cloudflared/config.yml << 'EOF'
tunnel: TUNNEL_ID
credentials-file: /home/linuxuser/.cloudflared/TUNNEL_ID.json
ingress:
- hostname: minnie-webhook.cfargotunnel.com
service: http://localhost:8080
- service: http_status:404
EOF
IMPORTANT: Replace both instances of TUNNEL_ID with your actual tunnel ID
cloudflared tunnel route dns minnie-webhook minnie-webhook.cfargotunnel.com
This gives you: https://minnie-webhook.cfargotunnel.com (permanent URL)
cloudflared tunnel run minnie-webhook
Should see: "Connection established" and tunnel info
Press Ctrl+C to stop (we'll run it via systemd next)
sudo cp /home/linuxuser/.openclaw/workspace/systemd/minnie-webhook.service /etc/systemd/system/
sudo cp /home/linuxuser/.openclaw/workspace/systemd/cloudflare-tunnel.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable minnie-webhook.service
sudo systemctl enable cloudflare-tunnel.service
sudo systemctl start minnie-webhook.service
sudo systemctl start cloudflare-tunnel.service
sudo systemctl status minnie-webhook.service
sudo systemctl status cloudflare-tunnel.service
Should see: Active: active (running)
curl https://minnie-webhook.cfargotunnel.com/health
Should return: {"status":"healthy","service":"pubsub-webhook"}
Go to: console.cloud.google.com → Pub/Sub → Subscriptions
openclaw-gmail-pushopenclaw-eventshttps://minnie-webhook.cfargotunnel.com/webhooks/gmail/quan@ztag.comSend an email to quan@ztag.com from any account
sudo journalctl -u minnie-webhook.service -f
Should see: "📧 Gmail event for quan@ztag.com: [historyId]"
If you see this, you're DONE! Gmail Pub/Sub is fully operational.
# Check if container is running
docker ps | grep openclaw
# Check logs
sudo journalctl -u minnie-webhook.service -n 50
# Check credentials file exists
ls ~/.cloudflared/*.json
# Check config is valid
cloudflared tunnel info minnie-webhook
# Check logs
sudo journalctl -u cloudflare-tunnel.service -n 50
# Verify tunnel is reachable
curl https://minnie-webhook.cfargotunnel.com/health
# Check Gmail watch is active (should expire in ~7 days)
# If expired, re-run: python3 tools/gmail-watch-setup.py quan@ztag.com minniebot openclaw-events
Check status:
sudo systemctl status minnie-webhook.service
sudo systemctl status cloudflare-tunnel.service
View logs:
sudo journalctl -u minnie-webhook.service -f
sudo journalctl -u cloudflare-tunnel.service -f
Restart services:
sudo systemctl restart minnie-webhook.service
sudo systemctl restart cloudflare-tunnel.service
Stop services:
sudo systemctl stop minnie-webhook.service
sudo systemctl stop cloudflare-tunnel.service
Permanent infrastructure:
Gmail Pub/Sub flow:
Gmail → Google Pub/Sub → Cloudflare Tunnel (HTTPS) → Webhook Server (container) → Event processing
Result: Real-time email notifications, permanent, secure, auto-recovering.
Services will survive container restarts, VPS reboots, and crashes. This is production-ready infrastructure.