Script to send messagges on telegram groups

Hello to all,
firstly congratulations for this fantastic product.

I have a request, is possible to have a script that will send notifications and alert to a telegram group with a bot?

For our customers we use Telegram Groups for maintaince (with Zabbix).
We use a groups for every customer, in every group there are all our technitians and 1/2 internal manager of customer.
When we have an alert or a notification for a customer this is automatically sent in the specific group.

Thanks

Hi @clanto
It may be possible but we will have to wait for one of the script developers to give a final verdict. One thing that comes to mind though is IFTTT.

Hi @Rick_C ,
we have tested thought IFTTT (with Zappix) in past, with IFTTT we use mail system. IFTTT check mails and when it found the correct string it sorted the alterts in telegram groups.
But we had a lot of problems with this system and we started to use direct integration with Zabbix that was much better and faster.

Hello @clanto

We welcome you to the COMOD family. Have a great journey ahead with us.
First of all, i just want to thank to you for an intersting script request. Script has been completed for your request. Kindly, find the JSON script file below:

NOTE: You need to enter the folowing details ast the top of the script:

  1. TOKEN_ID: yyyyyyyyy:zzzzz_xxxxx
  2. CHAT_ID: 123456789 # May have postive or negative values
  3. MESSAGE: “Message want to send”

How to get Token id?

  • The first thing you want to do is register with Telegram if you haven’t done it yet. To do that, just go and download the app from the store (depending on what smartphone you’ve got).
  • Launch the BotFather by opening this link: https://telegram.me/botfather
  • Start a conversation with the BotFather by typing /newbot – This will start the Bot creation wizard.
  • At this point, you will be asked to provide a Friendly name and a username. Once that is done, you will be provided with the token to be used in our scripts.

How to get Chat id or Group id?

  • Add the bot to the group.
  • Send a dummy message to the bot. For Example: /my_id @my_bot
  • Go to the following URL: https://api.telegram.org/botXXX:YYYY/getUpdates
  • Look for "chat":{"id":-zzzzzzzzzz, -zzzzzzzzz is your chat id (With the negative sign)

Thank you

20190208-Telegram.json (2.51 KB)

THank you very much, tomorrow I will test the script and send you a feedback.

I have tested the script, it’s perfect, but I have done a made a change.
I edited:
print ecmd(‘powershell “%s”’%file_path)
to:
print ecmd(‘powershell -ExecutionPolicy unrestricted “%s”’%file_path)

because we have execution policy set to restricted.