Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Telegram Bot getUpdates VS setWebhook

I want to develop a bot for a business! I don't know that using getUpdates method for develop a windows desktop application and run that on vps (by https://github.com/MrRoundRobin/telegram.bot library) or using setWebhook method to develop bot with php!

Which one is better in terms of speed and etc? And what are some other differences?

like image 889
nabeghe Avatar asked Oct 14 '16 00:10

nabeghe


People also ask

How can I identify a telegram bot?

Bots in Telegram will look different from human users: their chat and profile screens have a slightly different UI and they don't have access to all messages by default when added to groups.

How can I get telegram API ID and hash?

Obtaining api_id Sign up for Telegram using any application. Log in to your Telegram core: https://my.telegram.org. Go to "API development tools" and fill out the form. You will get basic addresses as well as the api_id and api_hash parameters required for user authorization.

What is webhook for Telegram bot?

Setting up a webhook means that you will provide Telegram with a URL that is accessible from the public internet. Whenever a new message is sent to your bot, Telegram (and not you!) will take the initiative and send a request with the update object to your server.

Can Telegram BOT send message to channel?

Create a Telegram bot NOTE: Bots can't message people first, but can message channels.


1 Answers

It does not matter you want to use which kind of server side applications. Typically getUpdates used for debugging. For publishing your bots, you need to using the Webhook. See this.

getUpdates is a pull mechanism, setWebhook is push. There are some advantages of using a Webhook over getUpdates:

  1. Avoids your bot having to ask for updates frequently.
  2. Avoids the need for some kind of polling mechanism in your code.
like image 70
n.y Avatar answered Jan 02 '23 11:01

n.y