add secrets.BOT_WEBHOOK_URL
Deploy app frontend / app frontend (push) Successful in 2m3s
Deploy service couchdb / service couchdb (push) Successful in 26s
Deploy db-migrations / db-migrations (push) Successful in 1m30s
Deploy service message-delivery-method-web-push / service message-delivery-method-web-push (push) Successful in 1m30s
Deploy service tg-bot / service tg-bot (push) Successful in 1m23s

This commit is contained in:
2024-12-19 17:25:32 +02:00
parent 0890824807
commit 034a22bd30
4 changed files with 8 additions and 3 deletions
+1
View File
@@ -22,6 +22,7 @@ export const env = {
BOT_TOKEN: process.env.BOT_TOKEN,
BOT_USE_CHANGES_DB_UPDATES:
`${process.env.BOT_USE_CHANGES_DB_UPDATES}` === "true",
BOT_WEBHOOK_URL: process.env.BOT_WEBHOOK_URL,
READ_BASE_URL: process.env.READ_BASE_URL,
APP_BASE_URL: process.env.APP_BASE_URL,
API_URL: process.env.API_URL,
+3 -1
View File
@@ -7,7 +7,9 @@ import { MyContext } from "../types/myContext";
export const setupWebHook = async (bot: Bot<MyContext>) => {
const designDocument = await setupWebhookDesignDocument();
const update: keyof typeof designDocument.updates = "saveUpdate";
const webhookUrl = `${env.PUBLIC_API_URL}/${TG_BOT_UPDATES_DB_NAME}/${designDocument._id}/_update/${update}`;
const webhookUrl =
env.BOT_WEBHOOK_URL ||
`${env.PUBLIC_API_URL}/${TG_BOT_UPDATES_DB_NAME}/${designDocument._id}/_update/${update}`;
if (designDocument.constants.telegram_webhook_url !== webhookUrl) {
await bot.api.setWebhook(webhookUrl, {
secret_token: designDocument.constants.telegram_secret_token,