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.

2.181 comments

  1. 우리카지노

    At this time I am going away to do my breakfast,
    later than having my breakfast coming yet again to read other news.

  2. 제왕카 지노

    This paragraph is in fact a fastidious one it assists new internet visitors,
    who are wishing in favor of blogging.

  3. 카지노사이트

    I am truly thankful to the owner of this website who has shared this great piece of writing at at this place.

  4. 우리카지노

    Howdy! Someone in my Facebook group shared this website
    with us so I came to look it over. I’m definitely enjoying the information. I’m
    book-marking and will be tweeting this to my followers!
    Exceptional blog and wonderful style and design.

  5. 더킹 카지노

    A person essentially lend a hand to make seriously articles I’d state.
    This is the very first time I frequented your website page and so far?
    I surprised with the analysis you made to make this
    actual submit amazing. Excellent activity!

  6. สล็อต

    Title

    […]The details talked about in the post are some of the ideal out there […]

  7. LA Weekly's List

    Specifically the type of content that improves the internet. Thanks!

  8. 솔레어카지노

    What’s up, I would like to subscribe for this weblog to take most recent updates, thus where can i do it please assist.

  9. 바카라 사이트

    Asking questions are truly nice thing if you are not
    understanding something fully, however this paragraph offers pleasant understanding yet.

  10. 우리 카지노

    I know this website provides quality dependent content and extra material, is
    there any other site which presents such things in quality?

  11. 솔레어카지노

    Hello, everything is going sound here and ofcourse every one is sharing
    information, that’s genuinely fine, keep up writing.

  12. 솔레어카지노

    Hello! I’m at work surfing around your blog from my new
    apple iphone! Just wanted to say I love reading your blog and look
    forward to all your posts! Carry on the outstanding
    work!

  13. SM카지노

    Hello there I am so excited I found your webpage,
    I really found you by accident, while I was browsing on Digg for something else, Anyways I am here
    now and would just like to say kudos for a marvelous post
    and a all round interesting blog (I also love the theme/design), I don’t have
    time to read through it all at the minute but I have bookmarked it and also
    added in your RSS feeds, so when I have time
    I will be back to read a great deal more, Please do keep up the superb work.

  14. 솔카지노

    Stunning quest there. What occurred after? Thanks!

  15. 우리 카지노

    What’s up to every single one, it’s genuinely a good for me to
    go to see this website, it consists of priceless Information.

  16. 우리 카지노

    I need to to thank you for this very good read!!

    I absolutely loved every bit of it. I have you book marked to look
    at new stuff you post…

  17. 카지노 쿠폰

    Does your website have a contact page? I’m having trouble locating it
    but, I’d like to shoot you an e-mail. I’ve got some suggestions
    for your blog you might be interested in hearing. Either way, great blog and
    I look forward to seeing it improve over time.

  18. 007 카지노

    Pretty nice post. I just stumbled upon your weblog and wanted to say
    that I have truly enjoyed browsing your blog posts. In any case I’ll be subscribing to your rss feed and I hope you write again very soon!

  19. click

    Title

    […]we prefer to honor many other web sites on the net, even though they aren’t linked to us, by linking to them. Under are some webpages worth checking out[…]

Tinggalkan Balasan

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