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.

139 comments

  1. PHP Classifieds script

    It’s going to be finish of mine day, however before end I am reading this great
    article to improve my knowledge.

  2. SMM Panel

    Amazing things here. I’m very happy to look your post.
    Thank you so much and I am having a look ahead to
    touch you. Will you please drop me a e-mail?

  3. Canlı Yayın Yazılımı

    Thanks for finally talking about >Basic Concept of Telegram Bot API – Dryan Christoph Personal Website <Loved it!

  4. 토토사이트

    Awesome! Its genuinely remarkable piece of writing, I
    have got much clear idea regarding from this post.

  5. ข่าวเกม

    When I originally commented I clicked the “Notify me when new comments are added”
    checkbox and now each time a comment is added I get several
    emails with the same comment. Is there any way you can remove me from that service?
    Cheers!

  6. Diploma certificate for sale

    Great web site. A lot of helpful info here. I am sending it to some pals ans also sharing in delicious.
    And obviously, thank you for your sweat!

  7. Elvis

    I do consider all of the concepts you have presented on your post.
    They are very convincing and can certainly work.
    Still, the posts are very brief for newbies. Could you please lengthen them a little from next time?
    Thank you for the post.

  8. hydra url

    Darknet Market Hydra is definitely expanding. What’s
    the danger?

    Hydra Market, the largest Russian language darknet Marketplace (DNM),
    is growing a new new head and it is organizing to expand into
    typically the

    English part of the particular Darknet. The threat associated with a rising, powerful, in addition to experienced player should certainly not
    be ignored despite the particular

    fact that the kick off was postponed due to be able
    to the COVID-19 outbreak. Precisely how serious would it be and exactly what is the danger in this article?

    Hydra Market is at present the biggest Russian vocabulary
    darknet Market (DNM). That is also much more aged than any existing

    English vocabulary DNMs. In December 2019, the Hydra
    crew declared the creation of many new projects, the many important

    of which usually are Eternos and AspaNET. Typically the previous is a brand new DNM for English-speaking thieves.
    The latter can be a brand new darknet that

    is going to be a great alternative to TOR.

    Feel free to visit my page :: hydra url

  9. Erica

    Hello There. I found your blog the usage of
    msn. This is a really well written article.
    I’ll be sure to bookmark it and return to read more of your useful information. Thanks for the post.
    I will definitely comeback.

  10. ön muhasebe

    Hmm it appears like your site ate my first comment (it was super long) so I guess I’ll just sum it up
    what I had written and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog writer but I’m
    still new to the whole thing. Do you have any recommendations for newbie blog writers?
    I’d genuinely appreciate it.

  11. Verlene

    Great web site you’ve got here.. It’s hard to find good
    quality writing like yours these days. I truly appreciate people like you!
    Take care!!

  12. Berniece

    Wow, wonderful weblog structure! How lengthy have you been running
    a blog for? you make blogging glance easy. The total glance of your site is magnificent, as well as the content
    material!

  13. Lan

    I think that is among the so much vital info for me.
    And i am satisfied studying your article.
    However want to observation on some common issues,
    The site taste is ideal, the articles is truly excellent : D.
    Excellent activity, cheers

  14. Dedra

    A motivating discussion is definitely worth comment.

    There’s no doubt that that you ought to publish more on this
    topic, it might not be a taboo matter but generally folks don’t
    discuss such subjects. To the next! Kind regards!!

  15. Adele

    What a information of un-ambiguity and preserveness of valuable knowledge on the topic of
    unpredicted feelings.

  16. Pedro

    Good day! Would you mind if I share your blog with my zynga group?
    There’s a lot of folks that I think would really appreciate your content.
    Please let me know. Cheers

  17. Penni

    Greetings I am so happy I found your site, I really found
    you by mistake, while I was looking on Google for something else, Anyhow I
    am here now and would just like to say many thanks for a fantastic post and a all round interesting blog (I
    also love the theme/design), I don’t have time to look over it all at the minute
    but I have saved it and also included your RSS feeds, so when I have
    time I will be back to read a lot more, Please
    do keep up the awesome work.

  18. Ali

    Hello there, I found your site via Google even as searching for a similar subject, your website
    got here up, it looks great. I have bookmarked it in my google bookmarks.

    Hi there, just became alert to your weblog through
    Google, and found that it’s truly informative.
    I’m gonna be careful for brussels. I will be grateful if you happen to continue this in future.
    Numerous other folks will be benefited from your writing.
    Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *