Learn Webhooks with Telegram

Kendrew C
3 min readSep 12, 2021
Photo by XPS on Unsplash

Webhooks have been gaining popularity over the years, and it is an important concept on the journey of a programmer. In fact, interest has been rising over the years, as can be seen below.

What are webhooks?

They’re a way to automatically send messages or information between other web applications. Essentially, what happens is that when a state changes, webhooks work to automatically ping a particular API. This means that data can be handled in real-time when a given event occurs.

How does it work?

Generally, the exchange of data occurs through a webhook URL.

For example, the usage of webhook in Telegram bots helps to save wasted computational power. One question to ask first is, how do the bots know whether users have sent a message?

For example, if a user sends /help over to the telegram bot

Well, for one, we could our server constantly poll to the telegram API and pull data over to check if the user has sent any messages. If the user has sent a message, then reply, else, do nothing.

--

--