Hello! Welcome to CodeNest.
If you want to How to create Website Screenshot Generator Telegram Bot then this post is just for you.
Taking website screenshots has never been easier! With this simple and professional Telegram Website Screenshot Generator Bot, you just need to send any website URL, and the bot will instantly capture a high-quality screenshot of the page and send it back to you all within seconds!
What is a Telegram Website Screenshot Generator Bot?
A Telegram Website Screenshot Generator Bot is an automated tool integrated into the Telegram platform that allows users to capture full-page screenshots of any website simply by sending a URL. The bot fetches the live page, takes a screenshot in real time using an API (like ScreenshotMachine), and sends the image back to the user in seconds.
How It Works
The bot takes a website URL from the user, sends it to a screenshot API like screenshotmachine.com, and returns a full-page screenshot image all in real time through Telegram.
You can see the demo⤵
Features
- Fast and real-time screenshot generation
- Supports Desktop, Tablet, and Mobile views
- Simple URL input via Telegram message
- Direct image download without opening browser
- Clean and user-friendly interaction
How to Use
- Open Telegram and search for your bot (or the provided bot username).
- Start the bot by clicking on the Start button.
- Send any website link (example:
https://example.com). - The bot will reply with a screenshot of that website.
- Tap and hold the image to download it or forward it.
Read the Documentation & Set Up the Bot.
Read the full documentation and set up your own Telegram bot. Below is the complete code for the Website Screenshot Generator Bot.
const BOT_TOKEN = "#########";
const API_KEY = "######";
const devices = [
{ name: "🖥 Desktop", dimension: "1366x768" },
{ name: "📱 Phone", dimension: "375x667" },
{ name: "📲 Tablet", dimension: "768x1024" },
];
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const { message, callback_query } = await request.json();
// If callback button clicked
if (callback_query) {
const chatId = callback_query.message.chat.id;
const name = callback_query.from.first_name || "there";
const data = callback_query.data;
if (data === "capture") {
await sendMessage(BOT_TOKEN, chatId, `⚡ *${name}*, please send a website link (with https://) to capture.`, []);
}
return new Response("Callback handled");
}
// Regular message
if (!message || !message.chat || !message.text) return new Response("Invalid");
const chatId = message.chat.id;
const text = message.text.trim();
const name = message.from.first_name || "there";
if (text === "/start") {
await sendMessage(BOT_TOKEN, chatId, `Hey *${name}* welcome to *SiteSnap*
Just send me any website link (starting with https://) and I'll capture high-quality screenshots in *Desktop*, *Tablet*, and *Mobile* views—all in seconds!
*⚡ No sign-ups, no wait—just instant, high-quality previews with download options!*`, [
[{ text: "📸 Capture Screenshot", callback_data: "capture" }]
]);
return new Response("Started");
}
if (text === "/help") {
await sendMessage(BOT_TOKEN, chatId, `⚙️ *How to Use SiteSnap Bot:*
1. Send a website link like \`https://example.com\`
2. Wait while I *capture screenshots*
3. You’ll get images for:
🖥 Desktop
📱 Phone
📲 Tablet
_Simple, fast & no signup needed._`);
return new Response("Help sent");
}
if (text === "/about") {
await sendMessage(BOT_TOKEN, chatId, `ℹ️ *About SiteSnap Bot*
SiteSnap is a fast and simple Telegram bot to generate website screenshots for different screen sizes.
⭐ *Features:*
• Auto screenshots (Desktop, Phone, Tablet)
• Instant previews + view buttons
• Supports homepage, posts & internal pages
• No signup needed
Created by @techankur12`);
return new Response("About sent");
}
const urlRegex = /(https?:\/\/[^\s]+)/;
const match = text.match(urlRegex);
if (!match) {
await sendMessage(BOT_TOKEN, chatId, "⚠️ No valid URL found. Please send a website link like:\n`https://example.com`");
return new Response("Invalid URL");
}
const siteUrl = match[0];
const encodedUrl = encodeURIComponent(siteUrl);
const timestamp = Date.now();
// Countdown Message
let countdown = 5;
const waitMsg = await sendMessage(BOT_TOKEN, chatId, `*⏳ Capturing screenshots Please wait ${countdown} seconds...*`);
const waitMsgId = waitMsg.result.message_id;
while (countdown > 1) {
await new Promise(resolve => setTimeout(resolve, 1000));
countdown--;
await editMessage(BOT_TOKEN, chatId, waitMsgId, `*⏳ Capturing screenshots Please wait ${countdown} seconds...*`);
}
await new Promise(resolve => setTimeout(resolve, 1000));
await deleteMessage(BOT_TOKEN, chatId, waitMsgId);
// Send 3 screenshots
for (const device of devices) {
const imageUrl = `https://api.screenshotmachine.com/?key=${API_KEY}&url=${encodedUrl}&dimension=${device.dimension}&format=png&cacheLimit=${timestamp}`;
await sendPhoto(BOT_TOKEN, chatId, imageUrl, [
[{ text: `🔍 View ${device.name}`, url: imageUrl }]
]);
}
return new Response("Screenshots sent");
}
async function sendMessage(token, chatId, text, buttons = []) {
const res = await fetch(`https://api.telegram.org/bot${token}/sendMessage`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
chat_id: chatId,
text,
parse_mode: "Markdown",
reply_markup: buttons.length ? { inline_keyboard: buttons } : undefined
})
});
return res.json();
}
async function editMessage(token, chatId, messageId, newText) {
return fetch(`https://api.telegram.org/bot${token}/editMessageText`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
chat_id: chatId,
message_id: messageId,
text: newText,
parse_mode: "Markdown"
})
});
}
async function deleteMessage(token, chatId, messageId) {
return fetch(`https://api.telegram.org/bot${token}/deleteMessage`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
chat_id: chatId,
message_id: messageId
})
});
}
async function sendPhoto(token, chatId, photoUrl, buttons = []) {
return fetch(`https://api.telegram.org/bot${token}/sendPhoto`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
chat_id: chatId,
photo: photoUrl,
reply_markup: { inline_keyboard: buttons }
})
});
}Watch this video for better guidance on setting up and using the bot.
Conclusion
The Telegram Website Screenshot Generator Bot is a powerful and time-saving tool for capturing high-quality website screenshots right from your chat. Whether you're a developer, designer, blogger, or just someone who needs quick previews of web pages this bot makes it fast, reliable, and incredibly easy. Try it out and simplify your workflow today!