Telegram chat connector: support long polling (mode: polling) so self-hosted instances without a public HTTPS URL can connect
Summary
The Telegram chat connector ("Chat with an agent") is hardcoded to webhook mode, which forces every self-hosted instance to be publicly reachable over HTTPS (PAPERCLIP_CHAT_WEBHOOK_PUBLIC_URL, port 443/80/88/8443) before it can connect a bot. The bundled adapter already supports long polling, which would let a self-hosted instance connect a Telegram bot with no public URL at all (same model other self-hosted bots use).
Motivation
Telegram bots do not inherently require a public endpoint. A bot can either:
- receive webhooks (needs a public HTTPS URL reachable by Telegram), or
- use long polling (
getUpdates), where the client polls Telegram — no inbound connectivity needed.
Tools like OpenClaw (and many self-hosted bots) use long polling, so operators connect a BotFather token without exposing anything to the internet. Paperclip's connector currently only offers the webhook path, so on a LAN-only/self-hosted instance the "Connect bot" button is disabled with "Configure a public HTTPS URL for this Paperclip instance before connecting Telegram."
Evidence
Adapter supports polling. @chat-adapter/[email protected] (bundled at node_modules/@paperclipai/server/node_modules/@chat-adapter/telegram/dist/index.js) implements a mode with long-poll/polling handling, including deleteWebhook before polling (e.g. around lines 1008–1143).
Paperclip hardcodes webhook. @paperclipai/server/dist/services/chat-sdk-runtime.js:752:
case "telegram": {
const adapterConfig = {
...config.credentials,
logger: resolvedLogger,
maxDownloadBytes: config.maxDownloadBytes,
mentionOnReply: true,
mode: "webhook", // <- hardcoded; adapter also supports "polling"
nativeStreaming: true,
userName: config.userName,
};
const adapter = createTelegramAdapter(adapterConfig);Server rejects without a public URL. @paperclipai/server/dist/services/chat-channels.js (~line 6567):
Telegram webhooks require PAPERCLIP_CHAT_WEBHOOK_PUBLIC_URL to use HTTPS on port 443, 80, 88, or 8443There is no config/env/UI to switch mode, and the webhook URL is built as ${webhookPublicBaseUrl}/api/chat-webhooks/${endpoint.publicId}/telegram.
Proposed change
- Add a Telegram connection option for long polling (e.g.
mode: "polling" | "webhook", default preserved for backward compat), exposing it via env (e.g.PAPERCLIP_TELEGRAM_MODE=polling) and/or the connect UI. - When polling:
- call
deleteWebhook(drop pending updates) and rungetUpdateslong-poll; - skip the
PAPERCLIP_CHAT_WEBHOOK_PUBLIC_URLrequirement entirely (the adapter/state already handles this).
- call
- Update the connector copy so it doesn't demand a public HTTPS URL in polling mode.
Workarounds today
- Expose the instance behind HTTPS on 443/80/88/8443 and set
PAPERCLIP_CHAT_WEBHOOK_PUBLIC_URL. - Run an external polling bridge (a small
getUpdatesprocess that talks to the Paperclip API), which re-implements what the adapter already does.
Environment
paperclipai 2026.916.1, self-hosted on macOS,paperclipai run --bind lan, dashboard athttp://localhost:3100.- Telegram connector:
Connectors → Telegram → Chat with an agent; token from BotFather; blocked at the "Connect bot" step.
Source: paperclipai/paperclip