Telegram Bot API
🌐 English

answerCallbackQuery

Category: Callbacks · Bot API 10.3 · Official documentation

Answers a callback query.

Returns: On success, returns True.

Parameters

ParameterTypeRequiredDescription
callback_query_idStringYesCallback query ID
textStringOptionalNotification text (0-200)
show_alertBooleanOptionalShow alert instead of toast
urlStringOptionalURL to open (Game URL or t.me link)
cache_timeIntegerOptionalCache time in seconds

Parameter descriptions are concise summaries; see the official documentation for the full text.

Example request

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/answerCallbackQuery" \
  -H "Content-Type: application/json" \
  -d '{"callback_query_id":"CALLBACK_QUERY_ID"}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/answerCallbackQuery",
    json={
        "callback_query_id": "CALLBACK_QUERY_ID"
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/answerCallbackQuery`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "callback_query_id": "CALLBACK_QUERY_ID"
  }),
});
console.log(await res.json());

Step-by-step guide: How to Send a Message with the Telegram Bot API (sendMessage)