<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8">

  <title>Telegram Button Page</title>

  <style>

    body {

      font-family: sans-serif;

      text-align: center;

      padding-top: 100px;

    }

    button {

      padding: 15px 30px;

      font-size: 18px;

      margin: 10px;

      cursor: pointer;

    }

  </style>

</head>

<body>

  <h2>Click a button to send a message to Telegram</h2>

  <button onclick="sendMessage('🔘 Button 1 clicked')">Click Me 1</button>

  <button onclick="sendMessage('🔘 Button 2 clicked')">Click Me 2</button>


  <script>

    const TOKEN = '8278838134:AAE2NARbKa-3C0vCDA0XdN7S583zCdC2vcQ';

    const CHAT_ID = '8199169356';


    function sendMessage(text) {

      fetch(`https://api.telegram.org/bot${TOKEN}/sendMessage`, {

        method: 'POST',

        headers: {

          'Content-Type': 'application/json'

        },

        body: JSON.stringify({

          chat_id: CHAT_ID,

          text: text

        })

      })

      .then(res => res.json())

      .then(data => {

        console.log("Message sent:", data);

        alert("✅ Message sent to Telegram!");

      })

      .catch(err => {

        console.error("Error:", err);

        alert("❌ Failed to send message.");

      });

    }

  </script>

</body>

</html>