-
- Lurker
- Posts: 2
- Liked: 1 time
- Joined: May 13, 2020 4:17 am
- Full Name: Ngô Quang Minh
- Contact:
How to send Notifications to Telegram
Hi!
I need veeam One to send Notifications to Telegram, but when I search for Document, I saw Veeam One has just supported MS Team or Slack. Can you help me with this case?
I need veeam One to send Notifications to Telegram, but when I search for Document, I saw Veeam One has just supported MS Team or Slack. Can you help me with this case?
-
- Enthusiast
- Posts: 67
- Liked: 31 times
- Joined: Dec 23, 2019 7:26 pm
- Full Name: Lick A Brick
- Contact:
Re: How to send Notifications to Telegram
Might not be the best option, but if you use Office365 for your mail you can use Power Automate to 'forward' the message using the Telegram API. A quick search returned this: https://www.linkedin.com/pulse/custom-m ... akinfieva/ haven't tried this myself but it give you what you want.
-
- Veeam Software
- Posts: 1495
- Liked: 655 times
- Joined: Jul 17, 2015 6:54 pm
- Full Name: Jorge de la Cruz
- Contact:
Re: How to send Notifications to Telegram
Hello Ngo,
Veeam ONE supports anything that you can run inside a Script. As you have seen we already have a few examples of notifications to X, for example: Regarding telegram, I think you can do something like this more or less? I remember one of my colleagues sent me this example; let me ping him.
These integrations are not officially supported, but we strongly encourage you to play with all of this and provide feedback. We might integrate natively telegram and others in upcoming releases, let's see.
Thanks a lot!
Veeam ONE supports anything that you can run inside a Script. As you have seen we already have a few examples of notifications to X, for example: Regarding telegram, I think you can do something like this more or less? I remember one of my colleagues sent me this example; let me ping him.
Code: Select all
$AlarmName=$args[0]
$AlarmState=$args[1]
$ObjectName=$args[2]
$Telegramtoken = "MY-TELEGRAM-BOT-ID"
$Telegramchatid = "MY-TELEGRAM-CHAT-ID"
$body = ConvertTo-JSON @{ Text="$(Get-Date) - " + "$AlarmName" + " alarm goes to " + "$AlarmState" + " on VM: " + "$ObjectName" }
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Uri "https://api.telegram.org/$($Telegramtoken)/sendMessage?chat_id=$($Telegramchatid)&text=$($body)"
Thanks a lot!
Jorge de la Cruz
Senior Product Manager | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2024 / InfluxAce / Grafana Champion
Senior Product Manager | Veeam ONE @ Veeam Software
@jorgedlcruz
https://www.jorgedelacruz.es / https://jorgedelacruz.uk
vExpert 2014-2024 / InfluxAce / Grafana Champion
-
- Veeam Software
- Posts: 43
- Liked: 16 times
- Joined: Aug 02, 2021 3:40 pm
- Full Name: Marc Molleman
- Contact:
Re: How to send Notifications to Telegram
Hi @minh3124,
In my lab I use the following 2 scripts to send notifications to Teams and to Telegram.
For Telegram you will need to create a Bot (and get the token) and a Group (for the Chat ID). These 2 articles basically explain how to get these:
https://sendpulse.com/knowledge-base/ch ... am-chatbot
https://sean-bradley.medium.com/get-tel ... b575520659
The script is below (make sure to change the token and chatid):
In Veeam ONE, under the Actions of the Alarm, you will need to add a "Run Script" action with the following: powershell.exe C:\vone-telegram.ps1 '%1' '%4' '%2'
The script for MS Teams is below. This script uses the same parameters in the "Run Script" action as the other one: powershell.exe C:\vone-teams.ps1 '%1' '%4' '%2'
If you want to change or add parameters, this KB article has more information: https://www.veeam.com/kb1552
In my lab I use the following 2 scripts to send notifications to Teams and to Telegram.
For Telegram you will need to create a Bot (and get the token) and a Group (for the Chat ID). These 2 articles basically explain how to get these:
https://sendpulse.com/knowledge-base/ch ... am-chatbot
https://sean-bradley.medium.com/get-tel ... b575520659
The script is below (make sure to change the token and chatid):
Code: Select all
$AlarmName=$args[0]
$AlarmState=$args[1]
$ObjectName=$args[2]
$Telegramtoken = "bot465874365873245873214A"
$Telegramchatid = "78434624"
$body = ConvertTo-JSON @{ Text="$(Get-Date) - " + "$AlarmName" + " alarm goes to " + "$AlarmState" + " on VM: " + "$ObjectName" }
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Uri "https://api.telegram.org/$($Telegramtoken)/sendMessage?chat_id=$($Telegramchatid)&text=$($body)"
The script for MS Teams is below. This script uses the same parameters in the "Run Script" action as the other one: powershell.exe C:\vone-teams.ps1 '%1' '%4' '%2'
Code: Select all
$AlarmName=$args[0]
$AlarmState=$args[1]
$ObjectName=$args[2]
$uri = "https://m365x000000.webhook.office.com/webhookb2/b03e017f-8d3c-4cac-aa8e-f3637ddb78a4@de9a57d7-4c99-4gz1-889e-53e668b82e89/IncomingWebhook/0dc9b801ce444b67ae03eda61a0aa725/3644420b-9a1b-4fc7-q9j3-897579569883"
$body = ConvertTo-JSON @{ Text="$(Get-Date)" + "`r`n" + "$AlarmName" + " alarm goes ->" + "$AlarmState" + " on VM: " + "$ObjectName" + "`r`n" }
Invoke-RestMethod -uri $uri -Method Post -body $body -ContentType 'application/json'
If you want to change or add parameters, this KB article has more information: https://www.veeam.com/kb1552
-
- Veeam Software
- Posts: 745
- Liked: 191 times
- Joined: Nov 01, 2016 11:26 am
- Contact:
Re: How to send Notifications to Telegram
Hi all,
Thanks for the scripts. I decided to set up the telegram in my lab and probably found a typo.
This line is not working for me
while this works
The rest is fine.
Thanks.
Thanks for the scripts. I decided to set up the telegram in my lab and probably found a typo.
This line is not working for me
Code: Select all
Invoke-RestMethod -Uri "https://api.telegram.org/$($Telegramtoken)/sendMessage?chat_id=$($Telegramchatid)&text=$($body)"
Code: Select all
Invoke-RestMethod -Uri "https://api.telegram.org/bot$($Telegramtoken)/sendMessage?chat_id=$($Telegramchatid)&text=$($body)"
Thanks.
-
- Veeam Software
- Posts: 43
- Liked: 16 times
- Joined: Aug 02, 2021 3:40 pm
- Full Name: Marc Molleman
- Contact:
Re: How to send Notifications to Telegram
Hi @RomanK, thanks for testing! It has been a while since I used it in my lab, because I got too many notifications on my phone
Just to make sure, did you add the "bot part" here in front of the token numbers? $Telegramtoken = "bot465874365873245873214A"
Just to make sure, did you add the "bot part" here in front of the token numbers? $Telegramtoken = "bot465874365873245873214A"
-
- Veeam Software
- Posts: 745
- Liked: 191 times
- Joined: Nov 01, 2016 11:26 am
- Contact:
Re: How to send Notifications to Telegram
Hi Marc,
Nice point, of course, I am not. I just copy-pasted provided token.
Nice point, of course, I am not. I just copy-pasted provided token.
-
- Lurker
- Posts: 2
- Liked: 1 time
- Joined: May 13, 2020 4:17 am
- Full Name: Ngô Quang Minh
- Contact:
Re: How to send Notifications to Telegram
Thanks for supported, I had done it
-
- Veeam Software
- Posts: 43
- Liked: 16 times
- Joined: Aug 02, 2021 3:40 pm
- Full Name: Marc Molleman
- Contact:
Re: How to send Notifications to Telegram
Hi @minh3124, thanks for the update, good to hear you got things working.
-
- Novice
- Posts: 4
- Liked: 1 time
- Joined: Oct 04, 2019 9:13 am
- Full Name: Tom De Schutter
- Contact:
Re: How to send Notifications to Telegram
As enthousiast as I am, I tried to add these notifications to our installation. (v11.0.0.1379)
Both Teams and Telegram get a popup, which is great. The message both display isn't.
Telegram:
{
"Text": "09/12/2022 10:38:39 - alarm goes to on VM: "
}
Teams:
09/12/2022 10:38:39
alarm goes -> on VM:
As the scripts and $args above seems to work for others, I'm pondering what could be different on my end?? Any thoughts?
Thanks
Both Teams and Telegram get a popup, which is great. The message both display isn't.
Telegram:
{
"Text": "09/12/2022 10:38:39 - alarm goes to on VM: "
}
Teams:
09/12/2022 10:38:39
alarm goes -> on VM:
As the scripts and $args above seems to work for others, I'm pondering what could be different on my end?? Any thoughts?
Thanks
-
- Veeam Software
- Posts: 43
- Liked: 16 times
- Joined: Aug 02, 2021 3:40 pm
- Full Name: Marc Molleman
- Contact:
Re: How to send Notifications to Telegram
Hi Tom,
It looks like the parameters aren't passed (the parameters include the Alarm state, VM name, etc.). Could you check if these are included in the paramaters in the Actions in Veeam ONE (like this: C:\vone-telegram.ps1 '%1' '%4' '%2')?
Thanks,
Marc
It looks like the parameters aren't passed (the parameters include the Alarm state, VM name, etc.). Could you check if these are included in the paramaters in the Actions in Veeam ONE (like this: C:\vone-telegram.ps1 '%1' '%4' '%2')?
Thanks,
Marc
-
- Novice
- Posts: 4
- Liked: 1 time
- Joined: Oct 04, 2019 9:13 am
- Full Name: Tom De Schutter
- Contact:
Re: How to send Notifications to Telegram
Forgive me sir, for I am an idiot.
My problem is solved. Thank you!
--Tom
My problem is solved. Thank you!
--Tom
-
- Veeam Software
- Posts: 43
- Liked: 16 times
- Joined: Aug 02, 2021 3:40 pm
- Full Name: Marc Molleman
- Contact:
Re: How to send Notifications to Telegram
Glad to hear it's working Tom!
Who is online
Users browsing this forum: No registered users and 6 guests