How to create simple web-hook to send alerts to Telegram

How to create simple web-hook to send alerts to Telegram

In this video, I have demonstrated how to create a simple web-hook which can send your Tradingview alerts to Telegram channel or group for zero cost.

⬜ Tools Used
Telegram Messenger
Replit – Cloud platform for hosting small programs
Postman – To test web-hooks before going live (Optional)
Cronjob – To set health-check and keep bot alive

⬜ Steps

Create Telegram Bot

  • Find BotFather and issue command /newbot
  • Provide bot name
  • Provide bot username – which should be unique and end with _bot
  • Once bot is created, you will get a message with token access key in it. Store the token access key.

Prepare Telegram Channel

  • Create new telegram channel
  • Add the bot @username_to_id_bot to it as admin and issue /start to find chat id
  • Store the chat id and dismiss @username_to_id_bot from channel
  • Find the bot created in previous step using bot username and add it to channel as admin

Setup replit

  • Create a free Replit account if you do not have it already.
  • Fork the repl – Tradingview-Telegram-Bot to your space and give a name of your choice.
  • Set environment variables – TOKEN and CHANNEL which are acquired from previous steps.
  • Run the REPL

Test with postman

  • Use the URL on repl and create web-hook post request URL by adding /webhook to it.
  • Create post request on postman and send it.
  • You can see that messages sent via postman appearing in your telegram channel.
  • append ?jsonRequest=true if you are using json output from alerts.

Json request example:

Set alerts from tradingview to web-hook

  • Use web-hook option and enter the webhook tested from postman in the web-hook URL

And that’s all, the webhook for Telegram Alerts is ready!!

Thanks for watching. Hope you enjoyed the video and learned from it 🙂

PS: I have made use of extracts from the open github repo: https://github.com/fabston/TradingView-W…