# Fix OpenClaw Telegram Delivery + Add Discord Backup ## Context Telegram message delivery from Pipo has a **37% failure rate** (107/284 messages lost over 3 days). The AI generates responses visible on the dashboard, but they never reach Ignacio's Telegram chat. Root cause: network config forces IPv4-only connections on a dual-stack Oracle Cloud VPS, causing periodic polling stalls that kill outbound delivery. ## Step 1: Fix Telegram Network Config **File:** `~/.openclaw/openclaw.json` (line ~2002-2005) Change: ```json "network": { "autoSelectFamily": false, "dnsResultOrder": "ipv4first" } ``` To: ```json "network": { "autoSelectFamily": true, "dnsResultOrder": "ipv4first" } ``` This enables Node.js dual-stack failover (IPv4 preferred, IPv6 as fallback). ## Step 2: Restart the Gateway ```bash # Find and restart the openclaw gateway process # The process runs as PID 527506 (openclaw-gateway) openclaw gateway restart # OR if that doesn't work, kill and let systemd/supervisor respawn it ``` ## Step 3: Add Discord as Backup Channel Discord extension is already installed at `/usr/lib/node_modules/openclaw/extensions/discord/`. Just needs configuration. 1. **Create Discord bot:** - Go to https://discord.com/developers/applications - Click "New Application", name it (e.g. "Pipo") - Go to "Bot" tab → click "Reset Token" → copy the token - Enable **Message Content Intent** + **Server Members Intent** under Privileged Gateway Intents - Go to OAuth2 → URL Generator → select `bot` scope → select permissions: Send Messages, Read Message History, Attach Files, Use Slash Commands - Copy the generated URL and open it to invite the bot to your server 2. **Configure in openclaw.json:** ```bash openclaw config set channels.discord.enabled true --json openclaw config set channels.discord.token "BOT_TOKEN" --json ``` 3. **Pair** — DM the bot on Discord, OpenClaw will guide the pairing flow 4. Discord supports DMs, slash commands, server channels, threads, file attachments ## Step 4: Document for All Models Update `~/.openclaw/workspace/MEMORIES.md` (or equivalent shared memory file) with: - What the Telegram issue was and how it was fixed - That Discord is available as backup - That the gateway CAN be restarted when needed — Ignacio authorizes it - The `autoSelectFamily` setting and why it matters on Oracle Cloud Also update `CLAUDE.md` to clarify the gateway restart constraint — it's not an absolute prohibition, Ignacio can authorize restarts. ## Step 5: Verify 1. After restart, check logs: `grep "autoSelectFamily" /tmp/openclaw/openclaw-*.log` 2. Send a test message on Telegram — confirm "sendMessage ok" in logs 3. Monitor for polling stalls over the next hour 4. If Discord is set up, test a message there too ## Files to Modify - `~/.openclaw/openclaw.json` — network config fix + Discord channel config - `~/.openclaw/workspace/MEMORIES.md` — document fix for all models - `~/CLAUDE.md` — clarify gateway restart policy