If you want to enable Home Assistant Telegram notifications this video is for you.

Home Assistant – Telegram Notifications (How-To)

Why you need Home Assistant Telegram notifications?

You can use notifications in Home Assistant for many different things.

For Example:

Home Assistant support wide variety of platforms for notifications.

By the end of this How-To you will know how to use Telegram to deliver notifications from Home Assistant to your iOS, Android device or your Desktop PC or MAC

Home Assistant Telegram Notifications
Home Assistant Telegram Notifications

In this article I will also show you how to create an automation that will monitor for state changes of the Presence Sensor and when that happens a Home Assistant Telegram notification will be created.

Requirements

To complete this tutorial you will need:

  1. Working Home Assistant!
  2. A smashed Subscribe to my newsletter button

If you don’t have Home Assistant yet you can read my article and watch my video – here

Of course you can search for “Telegram” in the integration section or you can directly hit the following link –  https://www.home-assistant.io/integrations/telegram/

Steps to Follow

Watch the video above or follow these steps to enable your Home Assistant Telegram notifications:

  1. You have to create a Telegram bot.
    • Follow those instructions to create one and get the API_AUTHENTICATION_TOKEN of your newly created bot .
    • You need to send a message to your new bot from your Telegram user, because bots are not allowed to contact users.
  2. You need to configure a Telegram bot in Home Assistant and define there your API key and the allowed chat ids to interact with.

To verify that everything is working before adding your configuration and credentials to Home Assistant, try opening the URL below in a browser and don’t forget to replace AUTHENTICATION_TOKEN and USER_ID with yours:

https://api.telegram.org/bot<AUTHENTICATION_TOKEN>/sendMessage?chat_id=<USER_ID>&text=Subscribe%20To%20Kiril%20Channel

If you manage to receive a Telegram message and only after you successfully subscribe to my newsletter (just kidding for the latter) you can continue to the Home Assistant configuration.


# Example configuration.yaml entry for the Telegram Bot
telegram_bot:
- platform: polling
api_key: YOUR_API_KEY
allowed_chat_ids:
- CHAT_ID_1
# Example configuration.yaml entry for the notifier
notify:
- name: NOTIFIER_NAME
platform: telegram
chat_id: CHAT_ID_2

Try it from Home Assistant

Choose the Services tab from the Developer Tools sidebar item, then from the drop-down menu select the “telegram_bot.send_message”. Enter the following JSON message into the Service Data field:

{
“title”: “Subscribe to Kiril’s YouTube channel”,
“message”: “And don’t forget to hit the Like button”
}

and press the CALL SERVICE button.

For instance to automatically create notifications when a Presence sensor is updated you can use Home Assistant automation.

This is my configuration example below that I also used in my video. You have to put these lines in your Automation.yaml file of your Home Assistant installation.

 # Example automation.yaml entry for Telegram 
- id: '1571544830794444'
alias: I'm home telegram
description: ''
trigger:
- entity_id: person.kiril
from: away
platform: state
to: home
condition: []
action:
service: notify.telegram
data:
title: Subscribe to Kiril's channel
message: "Please"
data:
photo:
- url: https://media.alienwarearena.com/media/tux-r.jpg
caption: Tux

To activate and test the automation you have to change the state of presence sensor “person.kiril” from “away” to “home”. You can do that manually through the developer menu in Home Assistant for example.

Support my blog

Above all – any sort of engagement on my YouTube channel does really help out a lot with the YouTube algorithm, so make sure you hit the Subscribe, Like and Bell buttons If you enjoy this post & video.

Also feel free to add me on Instagram, Snapchat and Twitter by searching for KPeyanski username. I post there (Twitter) pretty much daily.

I really hope that you manage to follow the steps in this video till the end and you have working Telegram notifications in your Home Assistant at the moment.

Don’t forget to subscribe to my newsletter here – https://peyanski.com/newsletter/

Stay safe and see you next time.


10 Comments

Borja · 20/11/2019 at 4:19 pm

Have you seen this: https://www.callmebot.com/blog/telegram-call-from-home-assistant/
To have Home Assistant to make Telegram phone calls (with Voice) instead of text messages.
Much easier to implement and the phone is “ringing” to inform about HA events. Great for Alarms or critical sensors being monitored.

    Kiril Peyanski · 20/11/2019 at 4:34 pm

    It looks very promising. I’ll definitely read it. I thought to create something similar, but using Twilio for the calls. Are you the author of this article?

      Borja · 28/11/2019 at 11:51 am

      @Kiril, are you talking about callmebot? To make telegram voice calls through an API? Then yes. I’m managing the API. I created that for myself but then some collegues and friends had the same need so I open it to everybody. People are using it a lot with HomeAssistant and OpenHab.

        Kiril Peyanski · 28/11/2019 at 12:01 pm

        Very good job Borja. Are there any limitations or costs? Maybe I should do a video/article about it.

          Borja · 28/11/2019 at 12:26 pm

          No. There is no limitation nor cost. Its free. So far the server is in AWS and has enough resources to manage the load without problems. So no need to pay for it.
          It would be great to have an article and video about it! I can create a link from the webpage to your article and video.

Matt · 26/11/2019 at 4:10 pm

Brilliant! This was very useful and got me where I needed to go. One thing that caused me a problem was the example test message were the quotation marks around “title” and “message” in your test message, which I copied and pasted. I think that’s an error because I could only get it to work when I realised I needed to remove them. Otherwise, thank you for a brilliant, and very clear tutorial.

    Kiril Peyanski · 26/11/2019 at 4:38 pm

    Thanks for the comment. From where exactly did you try to copy/paste? From video description/video itself or the blog post? I will try to fix it.

Borja · 28/11/2019 at 4:33 pm

BTW, you can use this webpage to get your Telegram USER_ID based on your mobile phone number:
https://www.callmebot.com/get-telegram-id-from-phone-number/

    Kiril Peyanski · 28/11/2019 at 4:55 pm

    It sounds to good to be true 🙂 It’s actually sounds so damn good that I’m start to wonder where is the catch? 🙂

      Borja · 13/12/2019 at 3:50 pm

      No catch. This is possible because it is a hobby 🙂 I created it for myself and a few friends….
      If you create a youtube video tutorial, I will link it from the web for users who need additional help to use it. You can contact me by Telegram if needed @callmebot_com

Leave a Reply

Your email address will not be published. Required fields are marked *