Talking Telegram With The ESP8266

At this point it’s something of a given that a member of the ESP8266 family is likely your best bet if you want to cobble together a small Internet-connected gadget. Costing as little as $3 USD, this well documented all-in-one solution really can’t be beat. But of course, the hardware is only one half of the equation. Deciding how to handle the software side of your homebrew Internet of Things device is another story entirely.

A simple Telegram ESP8266 switch

It would be fair to say that there’s no clear-cut “right” way to approach the software, and it really depends on the needs or limitations of your particular project. For example [Brian Lough] finds that building Telegram support into his ESP8266 allows him to accomplish his goals with the minimum amount of fuss while at the same time using an environment he’s already comfortable with. He recently wrote in to share one of his Telegram projects with us, and in the video after the break, takes the time to explain some of the things he likes best about controlling his hardware through the encrypted chat platform.

But you don’t have to take his word for it, you can try it yourself. Thanks to the software library that [Brian] has developed to connect his projects to Telegram, the aptly named “Universal Telegram Bot Library”, anyone can easily follow in his footsteps. Adding his Telegram library to your next ESP8266 project is as easy as selecting it in the Arduino IDE. From there the video explains the process for getting a bot ID from Telegram, and ultimately how you use it to receive messages from the service. What you do with those messages is entirely up to you.

According to [Brian], the main downside is that you are beholden to a web service to control your local devices; not ideal if the Internet goes down or you would rather your little hacker projects not talk to the big scary Internet in the first place. If you’d rather keep all your smart things talking within the confines of your own network, perhaps your next project could be setting up a private MQTT server.

5 thoughts on “Talking Telegram With The ESP8266

  1. “…the encrypted chat platform.” Is sadly not the case, or at least not end-to-end encrypted, with the exception of Secret Chats, which are device bound.

    That being said, I love this! I wrote multiple Telegram bots and tinker a lot with ESP8266’s, and so far I’ve always used a simple ‘proxy API / message broker’ inbetween. I will play with this for sure. Thanks Brian!

    1. Yeah, that was my first thought as well: either the communication between the ESP and the Telegram server is unencrypted or I missed something about serious crypto libraries being available for the 8266. So you probably shouldn’t use it to run your Uranium enrichment plant.
      But, likewise I loved the hacky idea of abusing a chat service and implementing it so well.
      Chapeau [Brian] !

Leave a Reply to VicCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.