Create up_gr.html
Browse files- up_gr.html +146 -0
    	
        up_gr.html
    ADDED
    
    | @@ -0,0 +1,146 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            <!DOCTYPE html>
         | 
| 2 | 
            +
            <html lang="en">
         | 
| 3 | 
            +
            <head>
         | 
| 4 | 
            +
                <meta charset="UTF-8">
         | 
| 5 | 
            +
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
         | 
| 6 | 
            +
                <title>Send Messages</title>
         | 
| 7 | 
            +
                <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/toastify-js/src/toastify.min.css">
         | 
| 8 | 
            +
                <style>
         | 
| 9 | 
            +
                    body {
         | 
| 10 | 
            +
                        font-family: Arial, sans-serif;
         | 
| 11 | 
            +
                        text-align: center;
         | 
| 12 | 
            +
                        background-color: #f0f0f0;
         | 
| 13 | 
            +
                        margin: 0;
         | 
| 14 | 
            +
                        padding: 0;
         | 
| 15 | 
            +
                    }
         | 
| 16 | 
            +
                    h1 {
         | 
| 17 | 
            +
                        background-color: #4CAF50;
         | 
| 18 | 
            +
                        color: white;
         | 
| 19 | 
            +
                        padding: 20px;
         | 
| 20 | 
            +
                        margin: 0;
         | 
| 21 | 
            +
                        border-bottom: 2px solid #388E3C;
         | 
| 22 | 
            +
                    }
         | 
| 23 | 
            +
                    .input-row {
         | 
| 24 | 
            +
                        display: flex;
         | 
| 25 | 
            +
                        justify-content: center;
         | 
| 26 | 
            +
                        gap: 10px;
         | 
| 27 | 
            +
                        margin-top: 20px;
         | 
| 28 | 
            +
                    }
         | 
| 29 | 
            +
                    .input-row input, .input-row textarea {
         | 
| 30 | 
            +
                        padding: 10px;
         | 
| 31 | 
            +
                        font-size: 16px;
         | 
| 32 | 
            +
                        border: 1px solid #ccc;
         | 
| 33 | 
            +
                        border-radius: 5px;
         | 
| 34 | 
            +
                    }
         | 
| 35 | 
            +
                    #groupNameInput {
         | 
| 36 | 
            +
                        width: 80%;
         | 
| 37 | 
            +
                        margin-top: 20px;
         | 
| 38 | 
            +
                    }
         | 
| 39 | 
            +
                    #groupIdOutput {
         | 
| 40 | 
            +
                        width: 80%;
         | 
| 41 | 
            +
                        margin-top: 20px;
         | 
| 42 | 
            +
                        padding: 10px;
         | 
| 43 | 
            +
                        font-size: 16px;
         | 
| 44 | 
            +
                        border: 1px solid #ccc;
         | 
| 45 | 
            +
                        border-radius: 5px;
         | 
| 46 | 
            +
                        background-color: #fff;
         | 
| 47 | 
            +
                    }
         | 
| 48 | 
            +
                    #createGroupButton, #copyGroupIdButton {
         | 
| 49 | 
            +
                        color: white;
         | 
| 50 | 
            +
                        background-color: #4CAF50;
         | 
| 51 | 
            +
                        border: none;
         | 
| 52 | 
            +
                        cursor: pointer;
         | 
| 53 | 
            +
                        padding: 10px 20px;
         | 
| 54 | 
            +
                        font-size: 16px;
         | 
| 55 | 
            +
                        border-radius: 5px;
         | 
| 56 | 
            +
                        margin-top: 20px;
         | 
| 57 | 
            +
                    }
         | 
| 58 | 
            +
                    #createGroupButton:hover, #copyGroupIdButton:hover {
         | 
| 59 | 
            +
                        background-color: #388E3C;
         | 
| 60 | 
            +
                    }
         | 
| 61 | 
            +
                </style>
         | 
| 62 | 
            +
            </head>
         | 
| 63 | 
            +
            <body>
         | 
| 64 | 
            +
                <h1>Создание группы и отправка сообщений</h1>
         | 
| 65 | 
            +
                <div class="input-row">
         | 
| 66 | 
            +
                    <input type="text" id="apiKeyInput" placeholder="Введите API ключ">
         | 
| 67 | 
            +
                    <input type="text" id="groupNameInput" placeholder="Введите название группы">
         | 
| 68 | 
            +
                </div>
         | 
| 69 | 
            +
                <div class="input-row">
         | 
| 70 | 
            +
                    <input type="text" id="chatIdsInput" placeholder="Введите chatIds через запятую">
         | 
| 71 | 
            +
                </div>
         | 
| 72 | 
            +
                <button id="createGroupButton">Создать группу</button>
         | 
| 73 | 
            +
                <input type="text" id="groupIdOutput" placeholder="ID созданной группы" readonly>
         | 
| 74 | 
            +
                <button id="copyGroupIdButton">Скопировать ID группы</button>
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
         | 
| 77 | 
            +
                <script>
         | 
| 78 | 
            +
                    document.getElementById('createGroupButton').addEventListener('click', async function() {
         | 
| 79 | 
            +
                        const apiKey = document.getElementById('apiKeyInput').value;
         | 
| 80 | 
            +
                        const groupName = document.getElementById('groupNameInput').value;
         | 
| 81 | 
            +
                        const chatIds = document.getElementById('chatIdsInput').value.split(',').map(id => id.trim());
         | 
| 82 | 
            +
                        if (!apiKey || !groupName || chatIds.length === 0) {
         | 
| 83 | 
            +
                            Toastify({
         | 
| 84 | 
            +
                                text: "Пожалуйста, заполните все поля.",
         | 
| 85 | 
            +
                                duration: 3000,
         | 
| 86 | 
            +
                                gravity: "top",
         | 
| 87 | 
            +
                                position: "right",
         | 
| 88 | 
            +
                                backgroundColor: "yellow",
         | 
| 89 | 
            +
                                stopOnFocus: true
         | 
| 90 | 
            +
                            }).showToast();
         | 
| 91 | 
            +
                            return;
         | 
| 92 | 
            +
                        }
         | 
| 93 | 
            +
                        const payload = {
         | 
| 94 | 
            +
                            groupName: groupName,
         | 
| 95 | 
            +
                            chatIds: chatIds
         | 
| 96 | 
            +
                        };
         | 
| 97 | 
            +
                        try {
         | 
| 98 | 
            +
                            const response = await fetch("https://api.green-api.com/waInstance1101952913/createGroup/fb4986a9d9cb40ef9be6c7b08cb9c98b7a3b1dc8c6834b0b92", {
         | 
| 99 | 
            +
                                method: 'POST',
         | 
| 100 | 
            +
                                headers: {
         | 
| 101 | 
            +
                                    'Content-Type': 'application/json'
         | 
| 102 | 
            +
                                },
         | 
| 103 | 
            +
                                body: JSON.stringify(payload)
         | 
| 104 | 
            +
                            });
         | 
| 105 | 
            +
                            if (!response.ok) {
         | 
| 106 | 
            +
                                throw new Error(`HTTP error! status: ${response.status}`);
         | 
| 107 | 
            +
                            }
         | 
| 108 | 
            +
                            const data = await response.json();
         | 
| 109 | 
            +
                            document.getElementById('groupIdOutput').value = data.chatId;
         | 
| 110 | 
            +
                            Toastify({
         | 
| 111 | 
            +
                                text: "Группа успешно создана.",
         | 
| 112 | 
            +
                                duration: 3000,
         | 
| 113 | 
            +
                                gravity: "top",
         | 
| 114 | 
            +
                                position: "right",
         | 
| 115 | 
            +
                                backgroundColor: "yellow",
         | 
| 116 | 
            +
                                stopOnFocus: true
         | 
| 117 | 
            +
                            }).showToast();
         | 
| 118 | 
            +
                        } catch (error) {
         | 
| 119 | 
            +
                            console.error('Error creating group:', error);
         | 
| 120 | 
            +
                            Toastify({
         | 
| 121 | 
            +
                                text: "Ошибка при создании группы.",
         | 
| 122 | 
            +
                                duration: 3000,
         | 
| 123 | 
            +
                                gravity: "top",
         | 
| 124 | 
            +
                                position: "right",
         | 
| 125 | 
            +
                                backgroundColor: "yellow",
         | 
| 126 | 
            +
                                stopOnFocus: true
         | 
| 127 | 
            +
                            }).showToast();
         | 
| 128 | 
            +
                        }
         | 
| 129 | 
            +
                    });
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                    document.getElementById('copyGroupIdButton').addEventListener('click', function() {
         | 
| 132 | 
            +
                        const groupIdInput = document.getElementById('groupIdOutput');
         | 
| 133 | 
            +
                        groupIdInput.select();
         | 
| 134 | 
            +
                        document.execCommand('copy');
         | 
| 135 | 
            +
                        Toastify({
         | 
| 136 | 
            +
                            text: "ID группы скопирован в буфер обмена.",
         | 
| 137 | 
            +
                            duration: 3000,
         | 
| 138 | 
            +
                            gravity: "top",
         | 
| 139 | 
            +
                            position: "right",
         | 
| 140 | 
            +
                            backgroundColor: "yellow",
         | 
| 141 | 
            +
                            stopOnFocus: true
         | 
| 142 | 
            +
                        }).showToast();
         | 
| 143 | 
            +
                    });
         | 
| 144 | 
            +
                </script>
         | 
| 145 | 
            +
            </body>
         | 
| 146 | 
            +
            </html>
         |