0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:45:25 +08:00
discourse/plugins/discourse-chat-integration
Sergei Dmitriev 8def92409e
FEATURE: Allow custom Telegram API base URL (#41818)
## What changed

Adds `chat_integration_telegram_api_base_url` setting for the Telegram
chat integration (discourse-chat-integration plugin)

The setting defaults to `https://api.telegram.org`, so existing
installations keep their current behavior.

## Why

Some Discourse installations cannot reach `api.telegram.org` directly
because Telegram is blocked or restricted by local network providers.

This setting allows administrators to route Telegram Bot API requests
through a trusted reverse proxy, such as a Cloudflare Worker, without
patching the plugin.

## Cloudflare Worker example

The following Worker can be deployed as a small Telegram Bot API proxy:

```js
export default {
  async fetch(request) {
    const url = new URL(request.url);

    if (
      !url.pathname.startsWith("/bot") &&
      !url.pathname.startsWith("/file/bot")
    ) {
      return new Response("Not found", { status: 404 });
    }

    url.hostname = "api.telegram.org";
    url.protocol = "https:";
    url.port = "";

    return fetch(new Request(url, request));
  },
};
```

The proxy must be trusted because Telegram bot tokens are included in
Bot API request paths.

---------

Co-authored-by: Régis Hanol <regis@hanol.fr>
2026-07-22 17:27:40 +02:00
..
admin/assets/javascripts/discourse DEV: Consolidate reusable components into ui-kit (#38703) 2026-05-11 18:07:36 -03:00
app DEV: Enable Style/RedundantSelf rubocop rule (#40098) 2026-05-19 19:27:45 +02:00
assets UX: Improve chat integration plugin provider setup (#38892) 2026-04-17 09:56:05 +10:00
config FEATURE: Allow custom Telegram API base URL (#41818) 2026-07-22 17:27:40 +02:00
db/migrate DEV: Remove flowdock chat integration (#38810) 2026-03-24 17:56:58 +10:00
lib/discourse_chat_integration FEATURE: Allow custom Telegram API base URL (#41818) 2026-07-22 17:27:40 +02:00
spec FEATURE: Allow custom Telegram API base URL (#41818) 2026-07-22 17:27:40 +02:00
test/javascripts/acceptance DEV: Remove plugin names from test titles (#39418) 2026-04-21 19:19:52 +02:00
package.json DEV: Add a script for generating external types in discourse-types (#37095) 2026-03-09 20:37:43 +01:00
plugin.rb FEATURE: Allow custom Telegram API base URL (#41818) 2026-07-22 17:27:40 +02:00
README.md
tsconfig.json DEV: Add a script for generating external types in discourse-types (#37095) 2026-03-09 20:37:43 +01:00

Chat Integration Plugin

Integrate your chat system of choice with Discourse.

For more information, please see: https://meta.discourse.org/t/chatroom-integration-plugin-discourse-chat-integration/66522