Skip to content

feat(notify): add proxy support for Telegram notifications#14

Open
whhphd wants to merge 1 commit intoNarcooo:masterfrom
whhphd:feat/telegram-proxy-support
Open

feat(notify): add proxy support for Telegram notifications#14
whhphd wants to merge 1 commit intoNarcooo:masterfrom
whhphd:feat/telegram-proxy-support

Conversation

@whhphd
Copy link

@whhphd whhphd commented Mar 14, 2026

Summary

  • Add optional proxy field to Telegram notify channel config
  • Use undici.ProxyAgent to route Telegram API requests through a proxy
  • Fall back to HTTPS_PROXY / HTTP_PROXY environment variables when proxy is not set in config

Motivation

Telegram API (api.telegram.org) is blocked in some regions (e.g. China). Users currently have no way to configure a proxy for Telegram notifications without system-wide TUN/VPN, which may interfere with other services (e.g. LLM API endpoints on internal networks).

Usage

{
  "type": "telegram",
  "botToken": "...",
  "chatId": "...",
  "proxy": "http://127.0.0.1:7890"
}

The proxy field is optional. When omitted, the code checks HTTPS_PROXY / HTTP_PROXY env vars. If none is set, fetch proceeds without a proxy (existing behavior).

Changes

  • packages/core/src/models/project.ts — Add optional proxy to Telegram schema
  • packages/core/src/notify/telegram.ts — Import undici.ProxyAgent, apply when proxy is configured
  • packages/core/src/notify/dispatcher.ts — Pass channel.proxy to sendTelegram
  • packages/core/package.json — Add undici dependency (bundled in Node 20+ but needed for TypeScript types)

Test plan

  • tsc --noEmit passes
  • All 151 existing tests pass (vitest run)
  • Manual test: Telegram notification sent successfully via http://127.0.0.1:7890 proxy

🤖 Generated with Claude Code

Telegram API (api.telegram.org) is blocked in some regions (e.g. China).
This adds optional proxy support so users can send notifications via a
local proxy without requiring system-wide TUN/VPN.

Changes:
- Add optional `proxy` field to Telegram notify channel schema
- Use undici ProxyAgent when proxy is configured
- Fall back to HTTPS_PROXY/HTTP_PROXY environment variables
- Add undici as explicit dependency (bundled in Node 20+ but needed for types)

Usage in inkos.json:
  {
    "type": "telegram",
    "botToken": "...",
    "chatId": "...",
    "proxy": "http://127.0.0.1:7890"
  }

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant