answerCallbackQuery method

Future<bool> answerCallbackQuery(
  1. String callbackQueryId, {
  2. String? text,
  3. bool? showAlert,
  4. String? url,
  5. int? cacheTime,
})

Use this method to send answers to callback queries sent from inline keyboards

The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.

On success, True is returned.

Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @Botfather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.

https://core.telegram.org/bots/api#answercallbackquery

Implementation

Future<bool> answerCallbackQuery(String callbackQueryId,
    {String? text, bool? showAlert, String? url, int? cacheTime}) async {
  var requestUrl = _apiUri('answerCallbackQuery');
  var body = <String, dynamic>{
    'callback_query_id': callbackQueryId,
    'text': text,
    'show_alert': showAlert,
    'url': url,
    'cache_time': cacheTime,
  };
  return await HttpClient.httpPost(requestUrl, body: body);
}