mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
Add Telegram bot integration for pipeline processing (#5185)
# Description of Changes This pull request introduces Telegram bot integration to the application, enabling users to send files via Telegram for processing through the pipeline. The main changes add configuration options, dependency management, and a new service for handling Telegram interactions. **Telegram bot integration:** * Added a new `TelegramPipelineBot` service (`TelegramPipelineBot.java`) that listens for incoming Telegram messages, downloads attached files or photos, places them in a pipeline inbox folder, waits for processing results, and sends the output files back to the user. The service includes error handling and status messaging. * Introduced a `TelegramBotConfig` configuration class to initialize and register the Telegram bot only when enabled via application properties. * Added a new `Telegram` configuration section to `ApplicationProperties` and the `settings.yml.template`, supporting options like enabling/disabling the bot, bot token/username, pipeline folder, processing timeout, and polling interval. [[1]](diffhunk://#diff-1c357db0a3e88cf5bedd4a5852415fadad83b8b3b9eb56e67059d8b9d8b10702R63) [[2]](diffhunk://#diff-1c357db0a3e88cf5bedd4a5852415fadad83b8b3b9eb56e67059d8b9d8b10702R580-R589) [[3]](diffhunk://#diff-12f23603ae35319a3ea08f91b6340d5d935216941fda2e69d2df1b6cd22a63f2R108-R115) **Dependency management:** * Added the `org.telegram:telegrambots` library to the project dependencies to support Telegram bot functionality. --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details. --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Anthony Stirling <[email protected]>
This commit is contained in:
co-authored by
Copilot
Anthony Stirling
parent
83e96a9aa3
commit
e7b030e6b5
@@ -367,6 +367,7 @@ advanced = "Advanced"
|
||||
title = "Security & Authentication"
|
||||
security = "Security"
|
||||
connections = "Connections"
|
||||
telegram = "Telegram"
|
||||
|
||||
[settings.licensingAnalytics]
|
||||
title = "Licensing & Analytics"
|
||||
@@ -4633,6 +4634,90 @@ description = "Automatically create user accounts on first SAML2 login"
|
||||
label = "Block Registration"
|
||||
description = "Prevent new user registration via SAML2"
|
||||
|
||||
[admin.settings.telegram]
|
||||
title = "Telegram Bot"
|
||||
description = "Configure Telegram bot connectivity, access controls, and feedback behavior."
|
||||
|
||||
[admin.settings.telegram.enabled]
|
||||
label = "Enable Telegram Bot"
|
||||
description = "Allow users to interact with Stirling PDF through your configured Telegram bot."
|
||||
|
||||
[admin.settings.telegram.botUsername]
|
||||
label = "Bot Username"
|
||||
description = "The public username of your Telegram bot."
|
||||
|
||||
[admin.settings.telegram.botToken]
|
||||
label = "Bot Token"
|
||||
description = "API token provided by BotFather for your Telegram bot."
|
||||
|
||||
[admin.settings.telegram.pipelineInboxFolder]
|
||||
label = "Inbox Folder"
|
||||
description = "Folder under the pipeline directory where incoming Telegram files are stored."
|
||||
|
||||
[admin.settings.telegram.customFolderSuffix]
|
||||
label = "Use Custom Folder Suffix"
|
||||
description = "Append the chat ID to incoming file folders to isolate uploads per chat."
|
||||
|
||||
[admin.settings.telegram.accessControl]
|
||||
title = "Access Control"
|
||||
description = "Restrict which users or channels can interact with the bot."
|
||||
|
||||
[admin.settings.telegram.enableAllowUserIDs]
|
||||
label = "Allow Specific User IDs"
|
||||
description = "When enabled, only listed user IDs can use the bot."
|
||||
|
||||
[admin.settings.telegram.allowUserIDs]
|
||||
label = "Allowed User IDs"
|
||||
description = "Enter Telegram user IDs allowed to interact with the bot."
|
||||
placeholder = "Add user ID and press enter"
|
||||
|
||||
[admin.settings.telegram.enableAllowChannelIDs]
|
||||
label = "Allow Specific Channel IDs"
|
||||
description = "When enabled, only listed channel IDs can use the bot."
|
||||
|
||||
[admin.settings.telegram.allowChannelIDs]
|
||||
label = "Allowed Channel IDs"
|
||||
description = "Enter Telegram channel IDs allowed to interact with the bot."
|
||||
placeholder = "Add channel ID and press enter"
|
||||
|
||||
[admin.settings.telegram.processing]
|
||||
title = "Processing"
|
||||
description = "Control polling intervals and processing timeouts for Telegram uploads."
|
||||
|
||||
[admin.settings.telegram.processingTimeoutSeconds]
|
||||
label = "Processing Timeout (seconds)"
|
||||
description = "Maximum time to wait for a processing job before reporting an error."
|
||||
|
||||
[admin.settings.telegram.pollingIntervalMillis]
|
||||
label = "Polling Interval (ms)"
|
||||
description = "Interval between checks for new Telegram updates."
|
||||
|
||||
[admin.settings.telegram.feedback]
|
||||
title = "Feedback Messages"
|
||||
description = "Choose when the bot should send feedback to users and channels."
|
||||
|
||||
[admin.settings.telegram.feedback.general.enabled]
|
||||
label = "Enable Feedback"
|
||||
description = "Control whether the bot sends feedback messages at all."
|
||||
|
||||
[admin.settings.telegram.feedback.channel]
|
||||
title = "Channel Feedback Rules"
|
||||
noValidDocument.label = "Show \"No valid document\" (Channel)"
|
||||
noValidDocument.description = "Suppress the no valid document response for channel uploads."
|
||||
errorProcessing.label = "Show processing errors (Channel)"
|
||||
errorProcessing.description = "Send processing error messages to channels."
|
||||
errorMessage.label = "Show error messages (Channel)"
|
||||
errorMessage.description = "Show detailed error messages for channels."
|
||||
|
||||
[admin.settings.telegram.feedback.user]
|
||||
title = "User Feedback Rules"
|
||||
noValidDocument.label = "Show \"No valid document\" (User)"
|
||||
noValidDocument.description = "Suppress the no valid document response for user uploads."
|
||||
errorProcessing.label = "Show processing errors (User)"
|
||||
errorProcessing.description = "Send processing error messages to users."
|
||||
errorMessage.label = "Show error messages (User)"
|
||||
errorMessage.description = "Show detailed error messages for users."
|
||||
|
||||
[admin.settings.connections.mobileScanner]
|
||||
label = "Mobile Phone Upload"
|
||||
enable = "Enable QR Code Upload"
|
||||
|
||||
Reference in New Issue
Block a user