Basic Concept of Telegram Bot API

Telegram is one of the best chat application in 2019. Its stability, reliability, and server-based chat data makes everything works very seamlessly in everyday use. More interestingly, there is an API to work with Telegram bot, so that we can make a very powerful bot to help us create many beneficial things, like sending report automatically, setting parameters via bot, and sending a broadcast message to users.

In this article, I will tell you the basic concept of telegram bot. Currently, two of the most popular event management tools in telegram bot are Long Polling and Webhook. These two methods are explained in telegram official website, but I will simplify the explanation in the hope of you guys can understand the basic principles better.

1. Long Polling

The concept of polling is very simple: your server continuously checking at a predetermined frequency (e. g : every 2 seconds) to check if there is someone sending a chat to your bot. If the result is empty, then you can simply do nothing. Otherwise, you will get an array of request data, such as chat id, sender id, group id (if chat is sent via group), the raw text sent by user, timestamp, and so on. Afterwards, the data is yours. You can process is and then reply to the chat based on chat id.

Telegram Bot Long Polling Concept

This method is very simple, yet requires continuous checking and creates more delay between request and response of the bot. Moreover, if the internet connection is unstable, your scheduler can pile up and creates a heavy load to the server. Therefore, Telegram BOT api provides second option which is more efficient for servers.

2. Webhook

Unlike long polling, webhook relies on speed and reliability. Using webhook, we don’t need to check every predetermined frequency whether or not there is someone chatting our bot. Instead, we only have to place our code in our hosted network, register the link to Telegram with our bot token code, so that whenever someone chats our bot, Telegram will send it to the webhook link we provided before. This is somehow a passive approach, but more efficient and doesn’t consume a lot of internet bandwidth.

Telegram Bot Webhook Concept

The downside is that we have to provide a hosted site and technically we can not put our code in non hosted local server. But if you really want to use webhook and you don’t have a hosted website, there is a workaround using ngrok. I will make a separate post about this later on.

So that’s it about basic concept of Telegram bot API. For more technical details about how to make a Telegram bot, I will make a post about this in a few days.

6.534 comments

  1. カジノエックス

    My partner and I absolutely love your blog and find the
    majority of your post’s to be exactly I’m looking for.
    Does one offer guest writers to write content available for you?
    I wouldn’t mind composing a post or elaborating on some of the subjects you write regarding here.
    Again, awesome web site!

  2. Naughty America

    I enjoy what you guys tend to be up too. This
    kind of clever work and coverage! Keep up the very good works guys I’ve added you guys to my own blogroll.

  3. 블랙 잭 룰

    Hiya very nice site!! Man .. Beautiful .. Amazing ..
    I’ll bookmark your blog and take the feeds additionally?

    I am happy to search out numerous helpful information right here in the publish, we want work out extra
    strategies in this regard, thank you for sharing.
    . . . . .

  4. online casino

    Fine way of explaining, and fastidious post to obtain data
    concerning my presentation focus, which i am going to convey in academy.

  5. 마이다스 카지노 솔루션 문의

    Very nice post. I just stumbled upon your blog and wished
    to mention that I have truly enjoyed browsing your blog posts.
    After all I’ll be subscribing in your feed and I
    am hoping you write again soon!

  6. 메리트 카지노 쿠폰

    Hi, I think your site might be having browser compatibility
    issues. When I look at your blog in Ie, it looks fine but when opening in Internet Explorer, it has some
    overlapping. I just wanted to give you a quick heads up!
    Other then that, fantastic blog!

  7. ceramic tile file

    Hi, after reading this amazing post i am too happy to share my familiarity here with mates.

  8. racy maiden gets 그녀의 beaver tamed

    Hello there, just became alert to your blog through Google, and found that it is really informative.
    I’m going to watch out for brussels. I’ll appreciate if you continue this in future.
    A lot of people will be benefited from your writing.
    Cheers!

  9. Shella Loguidice

    Hi there, there. I’m sure This is often off-matter, but I was wanting to know which weblog System are you currently using for This page? I’m obtaining fed up of WordPress mainly because I’ve experienced problems with hackers And that i’m taking a look at options for one more platform. I will be fantastic if you could possibly stage me in the path of an excellent System.

  10. satta matka

    Title

    […]although web sites we backlink to below are considerably not related to ours, we really feel they’re truly worth a go through, so possess a look[…]

  11. 007카지노

    Do you have a spam issue on this website; I also am a blogger, and I
    was wanting to know your situation; we have created
    some nice procedures and we are looking to swap methods with
    others, please shoot me an email if interested.

  12. bet365it

    Heya i am for the first time here. I found this board and I find It really useful & it helped me out a lot.
    I hope to give something back and help others like you aided me.

  13. 소녀는 두 dudes와 함께 좋은 시간을 가지고있다

    It is the best time to make a few plans for the future
    and it is time to be happy. I have learn this put up and if
    I may I want to suggest you some interesting things or advice.
    Maybe you could write next articles referring to this
    article. I desire to read more issues approximately
    it!

  14. 리비아 브리토 섹시 7

    It is actually a great and helpful piece of info.

    I am satisfied that you just shared this useful information with us.
    Please keep us up to date like this. Thanks for sharing.

  15. iso 14001 applicants

    I am sure this article has touched all the internet visitors,
    its really really fastidious post on building up new weblog.

  16. 여자 크림피스 creampie pussy

    Sweet blog! I found it while searching on Yahoo News.
    Do you have any tips on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get there!
    Thank you

  17. coin casino

    Since the admin of this web site is working, no question very soon it will
    be renowned, due to its quality contents.

  18. moringa tea

    I enjoy what you guys tend to be up too. This kind of clever work and
    coverage! Keep up the terrific works guys I’ve
    you guys to blogroll.

  19. JungleRaj casino

    Really no matter if someone doesn’t understand after that its up to
    other viewers that they will help, so here it happens.

  20. 더나인카지노

    Quality articles or reviews is the crucial to be a focus for the visitors to
    pay a visit the site, that’s what this site is providing.

  21. Payday loans

    What a information of un-ambiguity and preserveness of precious know-how on the topic of unpredicted
    emotions.

  22. 나 혼자 던져주는 녀석

    Very nice post. I just stumbled upon your weblog and wanted to mention that I’ve really enjoyed browsing your weblog posts.
    After all I will be subscribing for your rss feed and I’m hoping you
    write once more soon!

  23. スロット

    Heya i am for the primary time here. I found this board
    and I find It really helpful & it helped me out a lot.

    I hope to present something back and aid others such
    as you helped me.

  24. 골드 카지노

    Hi, i think that i saw you visited my web site thus i came to “return the favor”.I’m
    attempting to find things to enhance my site!I suppose its ok to
    use some of your ideas!!

  25. 끔찍한 애널

    I simply couldn’t leave your site prior to suggesting that I really loved
    the usual information an individual provide to your visitors?
    Is going to be again often to inspect new posts

  26. carrot recipes

    Terrific article! This is the type of info that should be shared
    around the internet. Shame on the search engines for not positioning this submit higher!
    Come on over and talk over with my website . Thanks =)

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *