File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ The config file is stored in the mounted `/usr/app/config` volume and can be nam
5858 " apiUrl" : " https://api.telegram.org" ,
5959 " token" : " 644739147:AAGMPo-Jz3mKRnHRTnrPEDi7jUF1vqNOD5k" ,
6060 " chatId" : " -987654321" ,
61+ " topic" : 5 ,
6162 },
6263 {
6364 " type" : " apprise" ,
Original file line number Diff line number Diff line change @@ -207,6 +207,15 @@ export class TelegramConfig extends NotifierConfig {
207207 @IsNotEmpty ( )
208208 chatId : string ;
209209
210+ /**
211+ * Identifier for the topic/thread to send the messages
212+ * @example 5
213+ * @env TELEGRAM_TOPIC
214+ */
215+ @IsInt ( )
216+ @IsOptional ( )
217+ topic ?: number ;
218+
210219 /**
211220 * Custom TELEGRAM server URL
212221 * @default https://api.telegram.org
@@ -1074,11 +1083,12 @@ export class AppConfig {
10741083 }
10751084
10761085 // Use environment variables to fill telegram notification config if present
1077- const { TELEGRAM_TOKEN , TELEGRAM_CHAT_ID } = process . env ;
1086+ const { TELEGRAM_TOKEN , TELEGRAM_CHAT_ID , TELEGRAM_TOPIC } = process . env ;
10781087 if ( TELEGRAM_TOKEN && TELEGRAM_CHAT_ID ) {
10791088 const telegram = new TelegramConfig ( ) ;
10801089 telegram . token = TELEGRAM_TOKEN ;
10811090 telegram . chatId = TELEGRAM_CHAT_ID ;
1091+ telegram . topic = TELEGRAM_TOPIC ? parseInt ( TELEGRAM_TOPIC , 10 ) : undefined ;
10821092 this . notifiers ??= [ ] ;
10831093 if ( ! this . notifiers . some ( ( notifConfig ) => notifConfig instanceof TelegramConfig ) ) {
10841094 this . notifiers . push ( telegram ) ;
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export class TelegramNotifier extends NotifierService {
3333 text : escapedMessage ,
3434 disable_web_page_preview : true ,
3535 parse_mode : 'MarkdownV2' ,
36+ ...( this . config . topic ? { message_thread_id : this . config . topic } : { } ) ,
3637 } ;
3738
3839 L . trace ( { jsonPayload } , 'Sending json payload' ) ;
You can’t perform that action at this time.
0 commit comments