Page 1 of 1

short Tutorial: Telegram Bot for notifications via HTTP (no Lua/Script/...)

Posted: Monday 20 June 2016 17:02
by Dominikat
Hello, since i was asked by a friend how to use Telegram Bots for notifications i wanted to write a short Tutorial (a fast search didn't show one on this forum).

Since Telegram introduced Bots there is a simple way to tell Domoticz to send your Notifications to your Telegram-Account. You have to start a new Bot, start a chat and tell Domoticz to send the notifications to this chat. You can't control Domoticz via Telegram with this method, but you can get Notifications.
  1. Install Telegram
  2. start a chat with BotFather. He will show you a message beginning with "They call me the Botfather....."
  3. tell Botfather "/newbot"
  4. write the name of your bot and hit Enter
  5. Now give your bot a username. it must end with "bot". Simply write it and type Enter
  6. Now you get an address for you bot and - important!- an access token.
  7. Start a Chat with your new Bot identified by the username you gave him.
  8. type /start Enter
  9. tell the bot "Hello World" or something similar, the message does not matter.
  10. in your Browser open the address https://api.telegram.org/bot<yourBotToken>/getUpdates
  11. now you get a message back in your browser (a webpage opens). There is a part "{"id":<YourChatId,"first_name":...." Notice the chatId
  12. got to your Domoticz Page => Setup => Settings => Notifications. on the right you will find "Custom HTTP / Action"
  13. Click "Enabled"
  14. in the field "URL/Action" enter https://api.telegram.org/bot<YourBotApi ... t=#MESSAGE.
    For <YourBotApi> enter the API Key BotFather told you during Bot creation, for <YourChatId> your Chatid.
  15. Hit "Test" and you should get the Domoticz Test Message
If you want your notifications to be delivered to more people simply add them to the chat.

If you want a specific Userpic for the bot, e.g. the Domoticz Logo, you can tell BotFather "/setuserpic", then pic your Bot from the list and upload a profile pic.

That's it, have fun!

Re: short Tutorial: Telegram Bot for notifications via HTTP (no Lua/Script/...)

Posted: Monday 20 June 2016 22:15
by simonrg
Have you had a look at the Domoticz wiki?

http://www.domoticz.com/wiki/Telegram_Bot

Re: short Tutorial: Telegram Bot for notifications via HTTP (no Lua/Script/...)

Posted: Sunday 26 June 2016 19:58
by Derik
Dear Dominikat,
I try your "wiki"...
Only i have in my browser a new Bot. [ Test ]
See the bot:
ScreenShot055.jpg
ScreenShot055.jpg (40.74 KiB) Viewed 10014 times
I cannot get/set a username ..
And i cannot find the bot in my windowsphone... app

Please some prints..

Re: short Tutorial: Telegram Bot for notifications via HTTP (no Lua/Script/...)

Posted: Sunday 09 September 2018 15:51
by niki_lauda
Dominikat wrote: Monday 20 June 2016 17:02 Hello, ...........
If you want your notifications to be delivered to more people simply add them to the chat.
How do you add someone to a chat??

Re: short Tutorial: Telegram Bot for notifications via HTTP (no Lua/Script/...)

Posted: Thursday 13 September 2018 16:57
by Plantje
Thank you for this brief tutorial! Agreed with other comments... everything can be found in the Wiki, but this is nice and clean!

Curious to know how to add more users as well!