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 Object
Defines a route to handle the Telegram Chatbot webhook.
- Since:
- 1.0.0
- Author:
- Sergio del Amo
-
Constructor Summary
ConstructorDescriptionTelegramController
(TokenValidator tokenValidator, Dispatcher<TelegramBotConfiguration, Update, Send> dispatcher) -
Method Summary
-
Constructor Details
-
TelegramController
public TelegramController(TokenValidator tokenValidator, Dispatcher<TelegramBotConfiguration, Update, Send> dispatcher) - Parameters:
tokenValidator
- TokenValidatordispatcher
- Message dispatcher
-
-
Method Details
-
callback
@Post public io.micronaut.http.HttpResponse<Send> callback(@Header("X-Telegram-Bot-Api-Secret-Token") 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:
-