Make your own Telegram bot to track ETH gas fees!

Reading time: 7 minutes

As you maybe know, apparently the DeFi boom, together with increased adoption and on-chain activity over the Ethereum network has brought with a huge increase in “fees” paid each time a user makes a transaction over that blockchain. That´s why it is always useful to check the gas price before we decide to send a transaction over that network.

Many people spend most of their time checking places like ETH Gas Station, ETH Gas.watch or using some notification service so they can be informed by the time those fees are at their lowest point and then, they can transfer or trade (still safe) some ETH coins or tokens without the need to pay an excessive amount of money to do it.

The Internet is plenty of tools, sites and services to do that but today i will teach you how to build a simple, customized Telegram bot to alert you when ETH gas fees are at a certain point that you want, adapted to your financial needs.

Now, thanks to HAL and Chainlink we can do it! A quick setup, a bit of magic and voilá! You will have your own customized tool to get alerts about those ETH gas fees that suits you. :)

What do we need?

Simple.... We will need Telegram running on any platform(Web, Desktop or Cellphone), an Ethereum Wallet (i recommend MetaMask) and a HAL account (you can sign up with GitHub or Google).

At this point, you maybe all know what is Telegram and what is Metamask. But maybe most of you do not know what is HAL so, allow me then to quickly introduce you to HAL...

HAL is a place where you can create customized triggers… using their web wizard or GraphQL APIs without the need of coding anything. You can connect decentralized and centralized technologies by using “recipes” they provide based on conditional structures like “IF -this- THEN -do this –”....by seizing the power of smart contracts and oracles like Chainlink this website will allow us to create “magic” like watching an incoming transaction to our wallets, tracking new token pool pair creation on Uniswap or getting an alert via Telegram, E-mail, Discord, Slack, Twitter, and even a webhook when ETH gas fees are on a threshold you want. You can do many more things of course, that´s why i encourage you, dear reader, to take quick look at HAL´s website and explore all the “recipes” they provide...we never know what do we will need in a future isn´t? **;)**

BUILDING THE BOT!

As said before, seizing the power of Telegram and HAL tools it will be easy to build this bot to stay informed about ETH gas fees on a given threshold or value.

** ON TELEGRAM

First we will need to create a Telegram bot allowing us to receive and post the message HAL will be sending to.

❶ Open Telegram and start a conversation with @BotFather which will allow you to create a new bot.

Just type-in the /newbot command and then reply each request made by BotFather by providing the name and the username for your bot.

❷ Save the token provided as we will be using it later.

❸ Now we will need to create a new Telegram group where our bot will be able to post the messages HAL will be sending regarding the ETH gas fees.

Once the group is created, assign it a name and invite the bot we’ve just created (@ethGasTrack_Bot in my case). Make it Administrator of your chat room.

❹ Now you will need to get the Chat_ID of the group you recently created. Send a message to the Group and start and send a message to the bot. Then go to:

https://api.telegram.org/bot<YourBOTToken>/getUpdates

...where is the token of the bot you´ve created with BotFather.

You will see something like this:

Grab the chat_id provided and you´re done!

It is time to move to HAL´s website to finish the magic! Let´s go!

** ON HAL´S WEBSITE

First we will need to create a trigger on HAL’s website that will send us a message when the gas price is below a certain value. After signing up to HAL’s website by using our Github or Google account we will need to:

❶ Go to the “Chainlink” card → “Explore Recipes”

❷Then click on “Track Gas Price” recipe.

❸ Once there we will find a screen with two sections: one with both keywords of the “IF- THEN” structure we will need to provide info to the triggers to execute and the second and last section allowing us to name that trigger(create, preview or reset).

Here we will need to tell HAL “WHEN” to execute the trigger. You can enter the value that suits you better and you will be notified when ETH gas price be less, equal or over the value you choose.

...and here we will need to tell HAL “WHERE” to send the message we want. In our case is a Telegram message which you will find it lower in the list.

❹ Choose “Send using Telegram” option

...and fill “BOT TOKEN” with the token of your newly created bot and “CHAT ID” with the chat_id you previously saved in steps above and choose a “MESSAGE FORMAT” that suits you better (i recommend to choose HTML)

Finally setup a name for your trigger and just click on“Create” button...and that’s all! You will get a notification on the group you created on Telegram via your own bot when the gas price matches your desired price...HAL will check it for you given some Chainlink data...Awesome!

Final thoughts...by now

At this point you may be asking yourself why to build a customized tool with HAL to be informed about ETH gas fees if you have several options already built on the Internet. Well...i can say that build your own tool customized to your needs sounds somehow fascinating and will allow you to learn how to use those recipes on HAL´s website also.

Besides, as it will be a tool built by you, you will have the chance to improve it when you need to do it without pay for it or ask other to do it for you...It is just a learning process that will introduce you to the world of HAL´s recipes and link them to your favorite centralized tool to stay up to date with the latest news and info on the cryptosphere.

Just test the other recipes....you will be amazed!! **;)**

If you are an enthusiast of historical photograph and amazing discoveries and stories do not forget to follow me at https://coil.com/u/deyner1984 because i will be releasing soon new and impressive contents about it!!!

...and if you valuate our work and want to support good and amazing content exclusively for you, do not forget to get a Coil subscription...it is a small fee to get great content for you and learn a lot!!!

─────────────

─────────────

** Fibonacci Retracements: ancient mathematicians helping today traders.

** Web Monetization in the context of Lightning Network

** Decentralized Applications (Dapps)...can be HACKED?

** Micropayments: beyond content creators.