WhatsApp/Telegram Message Generator

 <!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>WhatsApp/Telegram Message Generator</title>

    <link rel="stylesheet" href="styles.css">

</head>

<body>

    <div class="container">

        <h1>Message Link Generator</h1>

        <label for="phone">Enter Phone Number:</label>

        <input type="text" id="phone" placeholder="e.g., +1234567890">

        

        <label for="message">Enter Message:</label>

        <textarea id="message" placeholder="Type your message..."></textarea>

        

        <button onclick="generateLink('whatsapp')">Generate WhatsApp Link</button>

        <button onclick="generateLink('telegram')">Generate Telegram Link</button>


        <div id="result"></div>

    </div>

    <script src="script.js"></script>

</body>

</html>

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background: linear-gradient(to right, #25D366, #0088cc);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
    padding: 10px;
}

.container {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 100%;
}

h1 {
    margin-bottom: 15px;
    color: #333;
}

label {
    font-weight: bold;
    display: block;
    margin-top: 10px;
    text-align: left;
}

input, textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #25D366;
    border-radius: 5px;
    margin-top: 5px;
}

textarea {
    height: 80px;
    resize: none;
}

button {
    background: #25D366;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
    transition: 0.3s;
}

button:nth-child(3) {
    background: #0088cc;
}

button:hover {
    opacity: 0.8;
}

#result {
    margin-top: 15px;
    word-break: break-all;
}
function generateLink(platform) {
    let phone = document.getElementById("phone").value.trim();
    let message = document.getElementById("message").value.trim();
    
    if (phone === "") {
        alert("Please enter a phone number!");
        return;
    }

    let encodedMessage = encodeURIComponent(message);
    let link = "";

    if (platform === "whatsapp") {
        link = `https://wa.me/${phone}?text=${encodedMessage}`;
    } else if (platform === "telegram") {
        link = `https://t.me/${phone}?text=${encodedMessage}`;
    }

    document.getElementById("result").innerHTML = `
        <p><strong>Generated Link:</strong></p>
        <a href="${link}" target="_blank">${link}</a>
    `;
}

Contact Form