Telegram bot without webhook

Asked

Viewed 396 times

-2

I’m using the Telegram api Telegram bot to create a bot. I can already send messages, files, etc. I am creating commands for the "/setcommand" bot and I want this command to do something, a routine, run a php script, js, etc. I saw in the documentation the use of webhooks, I think roughly, when executing a command with bot the consumer will be the Telegram that turns on my infra via HTTP consume from a Rest, am I correct? The doubt is the following, how to make the bot execute commands without I need to provide a url/webhook for it, ex: I give HTTP POST in several contents, I believe it stays in cash on their servers, as I make a command of the bot consume something that has already been sent via API to Telegram?

  • So, if you are not using a webhook you should be using the getupdates method, only this is not the performative form, it exists only for "tests" where we create the bot, testing it and then we provide a webhook. The only way to automatically reply is via webhook, other than this, if you want to keep your page with getupdates, you would need to have a service that runs this page every x seconds and responds to bot interactions.

1 answer

0

I didn’t quite understand what you meant by "consuming something already sent via API", but the fact is that all the interaction of Telegram Bots happens via HTTP.

See more details on API.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.