Closed Keonik1 closed 5 months ago
Hey @Keonik1,
You're keeping me busy! 😄 Thanks a lot for all the helpful information!
I like the idea, but I'll need some time to dive into the Telegram topic and test a few things.
@jansppenrade2
I like the idea, but I'll need some time to dive into the Telegram topic and test a few things.
Sure, take as much time as you need to do it, it's not a life-saving feature. Thanks.
Hi @Keonik1,
I've implemented the ability to send notifications via Telegram. However, I'm facing some challenges with splitting the message in case it exceeds the maximum length of 4096 characters. Currently, the script only checks the length of the message to be sent, and if it exceeds 4096 characters, an error will be logged, but the message will be discarded.
I'm not sure if I'll be able to implement message splitting, but you're welcome to test the script with Telegram notifications already.
Here's the link: https://github.com/jansppenrade2/Docker-Container-Updater/blob/9337451192070bed6e13ef463aa3ca60fc5b3546/container_update.sh
Please tell me what you think.
Hint: Just execute the new version of this script or add the following values manually to your config file:
[telegram]
notifications_enabled=true
retry_limit=2
retry_interval=10
chat_id=<your_chat_id>
bot_token=<your_bot_token>
Hello @jansppenrade2
Thanks!
I have tested the ability to send messages to telegram. It seems to work correctly for me.
About message splitting, I'll look at how to implement it here later, because I've done something like that in the past, but probably next week.
If there are any suggestions for improvements, I'll post them in this issue or do it myself if it's easy to integrate.
Hey @Keonik1,
I had a spontaneous idea and came up with a solution for the message splitting.
If you could test it again, that would be great. I plan to merge it into the main branch this weekend because this version also includes some bug fixes...
Have a great weekend!
This feature has been added in version 2024.05.26-1.
Hello again.
I would like to suggest one more feature - notifications in telegram. To get access to mail often requires a number of efforts, which is not always convenient, but to look at the notification in Telegram is very quick and easy.
I understand that I will have to almost duplicate the
Send-MailNotification()
function, so I will just write the nuances.Set the message text
MESSAGE_MD="bold *text italic *text underline ~strikethrough~ ||spoiler|| bold italic bold ~italic bold strikethrough ||italic bold strikethrough spoiler||~ underline italic bold bold "
Optional set http proxy.
export http_proxy="http://127.0.0.1:3128"
export https_proxy="http://127.0.0.1:3128"
Use the curl command to send the message
curl -s -X POST https://api.telegram.org/bot$API_TOKEN/sendMessage -d chat_id=$CHAT_ID -d parse_mode="MarkdownV2" -d text="$MESSAGE_MD"