Class TelegramController
- java.lang.Object
-
- io.micronaut.chatbots.telegram.http.TelegramController
-
@Requires(beans={TokenValidator.class,Dispatcher.class,TelegramBotConfiguration.class}) @Requires(property="micronaut.chatbots.telegram.endpoint.enabled",notEquals="false",defaultValue="true") @Controller("${micronaut.chatbots.telegram.endpoint.path:/telegram}") public class TelegramController extends java.lang.Object
Defines a route to handle the Telegram Chatbot webhook.- Since:
- 1.0.0
- Author:
- Sergio del Amo
-
-
Constructor Summary
Constructors Constructor Description TelegramController(TokenValidator tokenValidator, Dispatcher<TelegramBotConfiguration,Update,Send> dispatcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.micronaut.http.HttpResponse<Send>
callback(java.lang.String apiSecretToken, Update update)
-
-
-
Constructor Detail
-
TelegramController
public TelegramController(TokenValidator tokenValidator, Dispatcher<TelegramBotConfiguration,Update,Send> dispatcher)
- Parameters:
tokenValidator
- TokenValidatordispatcher
- Message dispatcher
-
-
Method Detail
-
callback
@Post public io.micronaut.http.HttpResponse<Send> callback(@Header("X-Telegram-Bot-Api-Secret-Token") java.lang.String apiSecretToken, @Body Update update)
- Parameters:
apiSecretToken
- A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request.update
- Telegram Message- Returns:
- HTTP Response. It could 200 OK with an empty body if the request is handle asynchronously or a 200 with the response payload if the request is handled synchronously.
- See Also:
- setWebhook
-
-