Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wiki page for Webhook bot #1198

Open
geriko2000 opened this issue Mar 4, 2023 · 3 comments
Open

Add wiki page for Webhook bot #1198

geriko2000 opened this issue Mar 4, 2023 · 3 comments

Comments

@geriko2000
Copy link

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

@geriko2000 geriko2000 changed the title Add wiki age for Webhook bot Add wiki page for Webhook bot Mar 4, 2023
@Pyr0x1
Copy link

Pyr0x1 commented May 17, 2023

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.

@loolzaaa
Copy link
Contributor

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

@slavikf1
Copy link

slavikf1 commented Nov 6, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants