I am using Windows Power Automate Desktop to run multiple bots on my Computer. These bots do a specific task and update me when they have completed the task. They also send me relevant information on Email as well as Chat / Telegram. I created a way for these bots to let me know whenever they want to send me a message. The message can be a notification that they have started working, it can be a notification that the Bot has finished execution or they can also send me the message/output of the task they have done directly to me via an Instant Message. It comes in handy in almost all these scenarios.
Things you will need to begin:
- Telegram Account
- Telegram Bot
- API code of your Telegram Bot
- Windows Power Automate Desktop running on a Machine (Bot)
Assuming you already have Telegram Account with you, follow the below steps to register for a new Bot.
How to Create a New Bot for Telegram
Open Telegram messenger, sign in to your account or create a new one.
Step 1. Enter @Botfather in the search tab and choose this bot.
Note, official Telegram bots have a blue checkmark beside their name
Click “Start” to activate the BotFather bot.
In response, you receive a list of commands to manage bots.
Step 2. Choose or type the /newbot
command and send it.
Step 3. Choose a name for your bot — your subscribers will see it in the conversation. And choose a username for your bot — the bot can be found by its username in searches. The username must be unique and end with the word “bot.”
After you choose a suitable name for your bot — the bot is created. You will receive a message with a link to your bot t.me/<bot_username>, recommendations to set up a profile picture, description, and a list of commands to manage your new bot.
Make a note of the API Code.
Type /getid to get your Chat ID.
Now insert the API code in the below URL and your Chat ID and open it:
https://api.telegram.org/bot<api>/sendMessage?chat_id=<chatid>&text=Hello, There
Example:
https://api.telegram.org/bot1849589360:AAFW_O3pxt6NZJvoV-Ne8bSA/sendMessage?chat_id=188750&text=Hi
Once you are able to receive the message Hello, There it should confirm that the URL and the Syntax is working Fine.
We now need to just insert this into our Windows Power Automate Desktop Bot Code and we are good. Open Windows Power Automate Desktop and select Download from web in the Program.
Paste the URL and select the following setting.
Click Save and Run your Bot. Once the bot runs and this line is executed, you shall receive a message in Telegram.
Congratulations, you have successfully linked your Bot with your telegram account and now it can interact with you about anything you want it to.
If you are stuck somewhere, leave a comment and I shall be able to help you.