Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Remove telegram integration webhooks

Blue Mouse7c3b88a86d9a
diff --git a/backend/.env.example b/backend/.env.example
index 1d8d57d47..a87b8ebd3 100644
--- a/backend/.env.example
+++ b/backend/.env.example
@@ -68,11 +68,6 @@ ENABLE_TELEGRAM_INTEGRATION=false
# Telegram integration
TELEGRAM_BOT_TOKEN=''
-# Telegram webhook (production only)
-TELEGRAM_WEBHOOK_DOMAIN='' # domain name, for example api.swetrix.com
-TELEGRAM_WEBHOOK_PATH='/v1/telegram/webhook'
-TELEGRAM_WEBHOOK_IP_ADDRESS='' # server ip address
-TELEGRAM_WEBHOOK_SECRET_TOKEN='' # random string; Only characters A-Z, a-z, 0-9, _ and - are allowed, length of 1-256 characters.
# Paddle
PADDLE_VENDOR_ID=
diff --git a/backend/Dockerfile.prod b/backend/Dockerfile.prod
index 7100bfc2e..44546fa19 100644
--- a/backend/Dockerfile.prod
+++ b/backend/Dockerfile.prod
@@ -40,10 +40,6 @@ ENV TZ=UTC \
ENABLE_INTEGRATIONS=true \
ENABLE_TELEGRAM_INTEGRATION=true \
TELEGRAM_BOT_TOKEN= \
- TELEGRAM_WEBHOOK_DOMAIN= \
- TELEGRAM_WEBHOOK_PATH='/v1/telegram/webhook' \
- TELEGRAM_WEBHOOK_IP_ADDRESS= \
- TELEGRAM_WEBHOOK_SECRET_TOKEN= \
SENTRY_ENABLED=true \
SENTRY_DSN=
RUN apk add --no-cache tzdata && cp /usr/share/zoneinfo/$TZ /etc/localtime
diff --git a/backend/apps/production/src/configs/i18n.config.ts b/backend/apps/production/src/configs/i18n.config.ts
index ec3b3a87d..8a3797d35 100644
--- a/backend/apps/production/src/configs/i18n.config.ts
+++ b/backend/apps/production/src/configs/i18n.config.ts
@@ -12,5 +12,6 @@ export const getI18nConfig = (): I18nAsyncOptions => ({
path: join(__dirname, '..', 'i18n'),
watch: configService.get('NODE_ENV') === 'development',
},
+ logging: false,
}),
})
diff --git a/backend/apps/production/src/integrations/telegram/telegram.controller.ts b/backend/apps/production/src/integrations/telegram/telegram.controller.ts
deleted file mode 100644
index 131d5bf4d..000000000
--- a/backend/apps/production/src/integrations/telegram/telegram.controller.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import {
- Controller,
- Logger,
- Post,
- HttpCode,
- HttpStatus,
- Req,
- Request,
-} from '@nestjs/common'
-
-@Controller({ path: 'telegram', version: '1' })
-export class TelegramController {
- private readonly logger = new Logger(TelegramController.name)
-
- @Post('webhook')
- @HttpCode(HttpStatus.OK)
- async handleTelegramWebhook(@Req() request: Request) {
- this.logger.log(request.body)
- return 'OK'
- }
-}
diff --git a/backend/apps/production/src/integrations/telegram/telegram.module.ts b/backend/apps/production/src/integrations/telegram/telegram.module.ts
index 9bd47e6bf..157d935d3 100644
--- a/backend/apps/production/src/integrations/telegram/telegram.module.ts
+++ b/backend/apps/production/src/integrations/telegram/telegram.module.ts
@@ -3,7 +3,6 @@ import { ConfigService } from '@nestjs/config'
import { TelegrafModule } from 'nestjs-telegraf'
import { session } from 'telegraf'
import { TypeOrmModule } from '@nestjs/typeorm'
-import { TelegramController } from './telegram.controller'
import { TelegramUpdate } from './telegram.update'
import { StartScene } from './scene/start.scene'
import { ProjectsScene } from './scene/projects.scene'
@@ -23,19 +22,6 @@ import { AnalyticsModule } from '../../analytics/analytics.module'
token: configService.get<string>('TELEGRAM_BOT_TOKEN'),
launchOptions: {
dropPendingUpdates: false,
- ...(process.env.NODE_ENV === 'production' && {
- webhook: {
- domain: configService.get<string>('TELEGRAM_WEBHOOK_DOMAIN'),
- hookPath: configService.get<string>('TELEGRAM_WEBHOOK_PATH'),
- // ipAddress: configService.get<string>(
- // 'TELEGRAM_WEBHOOK_IP_ADDRESS',
- // ),
- maxConnections: 100,
- secretToken: configService.get<string>(
- 'TELEGRAM_WEBHOOK_SECRET_TOKEN',
- ),
- },
- }),
},
middlewares: [session()],
}),
@@ -45,7 +31,6 @@ import { AnalyticsModule } from '../../analytics/analytics.module'
ProjectModule,
AnalyticsModule,
],
- controllers: [TelegramController],
providers: [
TelegramUpdate,
StartScene,
diff --git a/backend/apps/production/src/main.ts b/backend/apps/production/src/main.ts
index d3b3e8a76..418ea51e6 100644
--- a/backend/apps/production/src/main.ts
+++ b/backend/apps/production/src/main.ts
@@ -5,7 +5,6 @@ import { ValidationPipe, VersioningType } from '@nestjs/common'
import cookieParser from 'cookie-parser'
import bodyParser from 'body-parser'
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'
-import { getBotToken } from 'nestjs-telegraf'
import { isDevelopment } from './common/constants'
import { AppModule } from './app.module'
@@ -61,11 +60,6 @@ async function bootstrap() {
app.use('/webhook/sns', bodyParser.raw())
app.use('/webhook/sns', bodyParser.text())
- if (process.env.NODE_ENV === 'production') {
- const bot = app.get(getBotToken())
- app.use(bot.webhookCallback(process.env.TELEGRAM_WEBHOOK_PATH))
- }
-
app.enableShutdownHooks()
await app.listen(5005)
diff --git a/backend/docker-compose-prod.yml b/backend/docker-compose-prod.yml
index 3af77d322..879fe31cc 100644
--- a/backend/docker-compose-prod.yml
+++ b/backend/docker-compose-prod.yml
@@ -43,10 +43,6 @@ services:
- ENABLE_INTEGRATIONS=true
- ENABLE_TELEGRAM_INTEGRATION=true
- TELEGRAM_BOT_TOKEN=
- - TELEGRAM_WEBHOOK_DOMAIN=
- - TELEGRAM_WEBHOOK_PATH='/v1/telegram/webhook'
- - TELEGRAM_WEBHOOK_IP_ADDRESS=
- - TELEGRAM_WEBHOOK_SECRET_TOKEN=
- SENTRY_ENABLED=true
- SENTRY_DSN=
links: