In this guide, I’m going to show you how to setup a Telegram notification bot. Telegram is a fantastic open-source cloud-hosted instant messaging software. It’s used by tens of millions of people all over the world and has integrations for many popular sites and services.

I primarily use Telegram for notifications. To monitor my self-hosted services, I use Uptime Kuma in a Docker container. Whenever something goes down, I receive a Telegram alert like this:

This image has an empty alt attribute; its file name is image-117.png

I also plan on using Telegram to receive image notifications from my Blue Iris NVR. The end goal is to have Blue Iris send a snapshot to Telegram whenever a Blue Iris alert is triggered. Telegram is excellent for this, as I can see the entire history of all images in one group chat. In this guide I’m just going to show how to setup the bot, but I’ll edit this guide with a link to on how to integrate it with Blue Iris once I have that setup.

Edit: Guide is now posted! How to How To Send Blue Iris Images to Telegram

To do this, we first need to create a Telegram bot. Let’s get started!


Set Up Telegram Bot

First, you need to create a Telegram account by downloading the Telegram mobile app.

Then, open the Telegram app on your phone. If this is the very first bot you’ve created in Telegram, you will first need to add the BotFather account to a message.

Click the pencil to start a new message. Then click the magnifying glass and search for Botfather.

Then type /start to get the BotFather bot setup.

Type /newbot to create a new bot.

Give it a name like BlueIrisAlertsBot. Then, choose a username for your bot; it must end in the word “bot”. I’m going to give it the username blueirisalerts_bot. Note that you may have to try a few different usernames to find an available one.

After creating the bot, it will display an HTTP API token.


Create Telegram Group and Add Bot

Next, we need to send a quick message to our new bot. This is because we’ll need to find the chat ID of the bot in the next step.

Click the pencil icon in Telegram > New Group. Search for the username of your new bot. Add the bot to the group, click the blue arrow, and then create a Group Name like “Blue Iris Alerts”. Click the checkmark afterwards.

This image has an empty alt attribute; its file name is image-120.png

Send Message to Group

Next, send a quick message to the group. Doing this will generate the Chat ID in a later step.


Copy API Key

Go back to the BotFather chat. Copy and HTTP API key and email it to yourself.

From a computer (mobile browser doesn’t work), go to this URL. Replace telegramAPIkey with the key you emailed to yourself.

https://api.telegram.org/bottelegramAPIkey/getUpdates

You should see a bunch of XML like this if it was successful:


Find Chat ID

Next, press CTRL+F on your keyboard. Then start searching for the word “chat” to find the Telegram Chat ID. Copy the chat ID to your clipboard including the – sign.

You will need this ID later, so I would write it down or paste it to Notepad temporarily.


Integrating Telegram with a Service

Now that you’ve gathered the API key and Chat ID, just follow the steps for any integration you plan on setting up. They will all ask for this info.

I intentionally made this guide short and sweet so I can link to it from other guides I post.


Wrapping Up

Hopefully this guide helps you create a new bot in just a few minutes!


My Homelab Equipment

Here is some of the gear I use in my Homelab. I highly recommend each of them.

The full list of server components I use can be found on my Equipment List page.

Similar Posts

7 Comments

  1. Nevermind, you can delete the previous comment. I think I was just to fast. I refreshed the page 5 minutes later and see all the XML now.

  2. ha ha! I just had the same issue. Then found this response. Refreshed and all is good!

  3. I am having the same issue here, I get a response = {“ok”:true,”result”:[]}
    I waited for 10 minutes, but the problem still exists.
    Pressing the F5 key to refresh the browser page, does not help.

  4. Hi Danny, it is ok, please ignore previous message: “{“ok”:true,”result”:[]}”
    I have found the solution.
    Actually, you need to press the START button with my newly created BOT and send simple message: HI,
    in order to get the chat ID.
    Thank you.

  5. Wild Laser says:

    For anyone having trouble with this, make sure the privacy setting of the bot is disabled so you can run getupdates. or do getme, I hear.
    You’re welcome!

  6. wild laser says:

    You may want to note that both bot and group Chat IDs show up, and that you must test!

Leave a Reply

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