Messaging & Communications Integration Guide
Test Telegram Bot API Webhooks Online
Test Telegram Bot update webhooks, inline queries, command payloads, and secret tokens in real time.
Direct Answer / Quick Summary
To test Telegram Bot webhooks, call `https://api.telegram.org/bot<TOKEN>/setWebhook?url=<SAFEWEBHOOK_URL>&secret_token=<SECRET>` in your browser. All Telegram messages sent to your bot will stream into SafeWebhook in real-time.
Key Capabilities & Testing Highlights
- •Inspect raw Telegram Update objects (message, callback_query, inline_query).
- •Validate X-Telegram-Bot-Api-Secret-Token header.
- •Instant debugging without running polling loops on your laptop.
- •Export Telegram payloads as cURL or Python requests to build bot handlers.
Signature Header
X-Telegram-Bot-Api-Secret-Token
Cryptographic Scheme
Plaintext Secret Token Check
Payload Retention
100% Client-Side
Step-by-Step Telegram Bot API Webhook Setup
Follow these 4 simple steps to capture real-time Telegram Bot API events in your browser:
1
Create a SafeWebhook URL at safewebhook.com/app.
2
Run: curl -F "url=https://safewebhook.com/api/r/YOUR_ID" -F "secret_token=my_secret" https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook
3
Send a message to your bot inside the Telegram app.
4
View the complete Update payload live in SafeWebhook.
Sample Telegram Bot API Webhook Payload
application/json{
"update_id": 10000,
"message": {
"message_id": 1365,
"from": {
"id": 1111111,
"is_bot": false,
"first_name": "John",
"username": "johndoe"
},
"chat": {
"id": 1111111,
"first_name": "John",
"username": "johndoe",
"type": "private"
},
"date": 1755541200,
"text": "/start welcome_ref"
}
}Telegram Bot API Signature Verification Recipes
Copy-paste production-ready HMAC verification code for your backend:
Node.js / Express Recipecrypto.timingSafeEqual
// Verify Telegram Secret Token
app.post('/telegram-webhook', (req, res) => {
const secret = req.headers['x-telegram-bot-api-secret-token'];
if (secret !== process.env.TELEGRAM_SECRET_TOKEN) {
return res.status(403).send('Unauthorized');
}
const update = req.body;
console.log('Received Telegram message:', update.message?.text);
res.sendStatus(200);
});Python / Flask / FastAPI Recipehmac.compare_digest
from flask import Flask, request, abort
@app.route('/telegram-webhook', methods=['POST'])
def telegram_webhook():
secret = request.headers.get('X-Telegram-Bot-Api-Secret-Token')
if secret != 'MY_SECRET_TOKEN':
abort(403)
update = request.json
print(f"Message from {update['message']['from']['username']}: {update['message']['text']}")
return 'ok', 200Frequently Asked Questions: Telegram Bot API Webhooks
How do I remove the webhook and switch back to long polling in Telegram?
Call `https://api.telegram.org/bot<TOKEN>/deleteWebhook` to reset your bot to getUpdates polling mode.
Ready to test Telegram Bot API webhooks in real-time?
Get your free, private edge endpoint instantly. Zero signup, zero credit card, 100% free forever.