ClawKit Logo
ClawKitReliability Toolkit

Fix "deleteWebhook failed: network request failed"

Telegram API Unreachable at Startup

When OpenClaw initializes a Telegram skill, it calls deleteWebhook to clear any stale webhook before registering a new one. A network failure at this step means the bot cannot start.

This error occurs when OpenClaw's Telegram skill cannot reach api.telegram.org. The most common causes are an invalid bot token, a blocked network, or a missing proxy configuration.

Next Step

Fix now, then reduce repeat incidents

If this issue keeps coming back, validate your setup in Doctor first, then harden your config.

What the Error Looks Like

telegram deleteWebhook failed: network request for 'deleteWebhook' failed!
Error: network request for 'deleteWebhook' failed!
FetchError: request to https://api.telegram.org/bot<TOKEN>/deleteWebhook failed
TypeError: fetch failed โ€” connect ETIMEDOUT 149.154.167.220:443
getaddrinfo ENOTFOUND api.telegram.org

Step 1 โ€” Verify Your Bot Token

An invalid or revoked token causes Telegram to reject the request before any network issue can be observed. Test your token directly:

Test token via curl
curl "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getMe"

Expected: {"ok":true,...}

If you get {"ok":false,"error_code":401} your token is invalid โ€” regenerate it via @BotFather using /revoke then /token.

Update your skill config with the new token:

Update bot token
openclaw config set skills.telegram.botToken "YOUR_NEW_TOKEN"
openclaw gateway restart

Step 2 โ€” Test Telegram API Connectivity

Run this from the same machine and user account that runs OpenClaw:

Test connectivity
# Basic reachability
curl -I https://api.telegram.org

# With timeout (should respond in < 5s)
curl --connect-timeout 5 https://api.telegram.org/bot<TOKEN>/getMe
curl: (6) Could not resolve host: api.telegram.org

DNS resolution is failing. See the DNS section below.

curl: (28) Connection timed out after 5000ms

Telegram API is blocked by your firewall or ISP. Common in mainland China and some corporate networks.

curl: (35) SSL connect error

TLS interception by a corporate proxy. Configure proxy settings or use a VPN.

Step 3 โ€” Configure a Proxy or VPN

If api.telegram.org is blocked in your region or network, configure an HTTP/HTTPS proxy for OpenClaw:

Set proxy in OpenClaw config
# Set outbound HTTP proxy
openclaw config set network.proxy "http://127.0.0.1:7890"

# Or set via environment variable
export HTTPS_PROXY="http://127.0.0.1:7890"
openclaw gateway restart

Common proxy ports by tool

  • :7890 โ€” Clash / ClashX default
  • :1080 โ€” shadowsocks / v2ray default
  • :8080 โ€” corporate proxy (check IT)
  • :10809 โ€” v2rayN Windows default

DNS Resolution Failures

If api.telegram.org fails to resolve, try a public DNS server:

Test with Google DNS
# Test with explicit DNS server
nslookup api.telegram.org 8.8.8.8

# Linux: temporarily use Google DNS
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

# Restart OpenClaw after changing DNS
openclaw gateway restart

Firewall and Outbound Rules

OpenClaw needs outbound HTTPS (port 443) to 149.154.160.0/20 and 91.108.4.0/22 (Telegram's IP ranges). On Linux servers:

Allow Telegram IPs (iptables)
# Allow Telegram API servers outbound
sudo iptables -A OUTPUT -d 149.154.160.0/20 -p tcp --dport 443 -j ACCEPT
sudo iptables -A OUTPUT -d 91.108.4.0/22 -p tcp --dport 443 -j ACCEPT

# Verify connectivity after
curl --connect-timeout 5 https://api.telegram.org

Running OpenClaw as a systemd Service?

When running as a systemd service, environment variables like HTTPS_PROXY are not inherited from your shell. Add them directly to the service file:

systemd service proxy config
# Edit your openclaw service file
sudo systemctl edit openclaw-gateway.service

# Add to [Service] section:
[Service]
Environment="HTTPS_PROXY=http://127.0.0.1:7890"
Environment="NO_PROXY=localhost,127.0.0.1"

# Reload and restart
sudo systemctl daemon-reload
sudo systemctl restart openclaw-gateway

Still Not Working?

Run the Doctor

npx clawkit-doctor@latest

Or use the web-based Error Doctor โ€” paste the full error to get a specific fix.

Did this guide solve your problem?