Closed geriko2000 closed 2 months ago
I second this, trying to switch to webhook mode from long polling, but I am struggling with it... by reading some comments in the issues I am not even sure webhook mode is working at the moment.
Webhook bots work correctly. What's a problem with it?
Some example:
public class ServiceWebhookBot extends TelegramWebhookBot {
// ...
}
// For serverless version (AWS Lambda + AWS Gateway)
TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class, new ServerlessWebhook());
// For simple server version
// TelegramBotsApi telegramBotsApi = new TelegramBotsApi(DefaultBotSession.class, new DefaultWebhook());
SetWebhook setWebhook = SetWebhook.builder().url(WEBHOOK_URL).build();
telegramBotsApi.registerBot(new ServiceWebhookBot(BOT_TOKEN), setWebhook);
BOT_TOKEN - environment variable with bot token WEBHOOK_URL - environment variable with webhook url (telegram server sent requests with updates to it)
WARNING: Telegram server sent webhooks only to https://...
urls!
Some old implementations here: https://github.com/loolzaaa/telegram-service-bot
@loolzaaa what I miss personally is how to initialize an extension of a SpringWebhookBot bot so it would be serverless (i.e. using a Spring-application controllers).
There are not examples of that and above-mentioned useful example is not mentioned in wiki.
you can try to use this example of implementation Spring and Webhook with current version of telegram api
This wiki does not have a page about the bot's webhook and how to set it up. It is very difficult to navigate, you need to climb into the source codes of the code and look for information yourself. Please add information. by connecting the bot in webhook mode