Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotificationsService: add telegram #1440

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

filimonic
Copy link

@filimonic filimonic commented Jan 27, 2025

Add support for notifications using telegram bot.

$Notification/T1=bot_token
$Notification/T2=chat_id
$Notification/Type=TG
$Notification/Send=Hello, World!

Memory usage:

Memory type Before changes After changes Difference
RAM 69796 69796 0
Flash 1845089 1845613 ⚠️+524

Setup:

Obtain bot token:
  • Register bot with @BotFather, and get bot token, e.g. 9999999999:ABCdefGHi-JKLmNOpQR-stuvw-xyz012345.
Obtain chat id:
  • Choose where you want to get notifications: in personal chat or in group chat.
    • Personal chat: if you want to get notifications to your personal chat, text /start to the bot
    • Group chat: if you want to get notifications to group chat, invite bot to group, text to group chat /nameOfYour_bot hello
  • Open https://api.telegram.org/bot{bot-token}/getUpdates in browser and get ..."chat":{"id":-1234567890 here. The number is chat id. Group chats have negative id, personal chats have positive id.
Setup FluidNC with commands:
  • $Notification/T1=bot_token, ex, $Notification/T1=9999999999:ABCdefGHi-JKLmNOpQR-stuvw-xyz012345
  • $Notification/T2=chat_id, ex, $Notification/T2=-1234567890
  • $Notification/Type=TG
Test notification:
  • Test notification with command $Notification/Send=Hello, World!
Inject notifications into G-Code:
  • For example, add $Notification/Send=Finished to your End G-Code in LightBurn

Add support for notifications using telegram bot.

```
$Notification/Type=TG
$Notification/T1=bot_token
$Notification/T2=chat_id
$Notification/Send=Hello, World!
```
@filimonic filimonic force-pushed the notifications-telegram branch from b6a81ad to f55698f Compare January 27, 2025 02:31
@MitchBradley
Copy link
Collaborator

Based on the rarity of questions about notifications, I suspect that you could count the number of people who use them on one hand. If they are as rarely used as I suspect, I wonder if it makes sense to add yet another variant that is likely to be used by a single person? Perhaps it would be possible to collapse the entire notifications service into a data-driven class that could send arbitrary messages to arbitrary endpoints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants