DmitrMakeev commited on
Commit
429a145
1 Parent(s): f21ef43

Create up_ad.html

Browse files
Files changed (1) hide show
  1. up_ad.html +98 -0
up_ad.html ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Manage Group Admin</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ text-align: center;
11
+ background-color: #f0f0f0;
12
+ margin: 0;
13
+ padding: 0;
14
+ }
15
+ h1 {
16
+ background-color: #4CAF50;
17
+ color: white;
18
+ padding: 20px;
19
+ margin: 0;
20
+ border-bottom: 2px solid #388E3C;
21
+ }
22
+ .input-row {
23
+ display: flex;
24
+ justify-content: center;
25
+ gap: 10px;
26
+ margin-top: 20px;
27
+ }
28
+ .input-row input {
29
+ padding: 10px;
30
+ font-size: 16px;
31
+ border: 1px solid #ccc;
32
+ border-radius: 5px;
33
+ }
34
+ #setAdminButton {
35
+ color: white;
36
+ background-color: #4CAF50;
37
+ border: none;
38
+ cursor: pointer;
39
+ padding: 10px 20px;
40
+ font-size: 16px;
41
+ border-radius: 5px;
42
+ margin-top: 20px;
43
+ }
44
+ #setAdminButton:hover {
45
+ background-color: #388E3C;
46
+ }
47
+ </style>
48
+ </head>
49
+ <body>
50
+ <h1>Manage Group Admin</h1>
51
+ <div class="input-row">
52
+ <input type="text" id="apiKeyInput" placeholder="Enter API Key">
53
+ <input type="text" id="groupIdInput" placeholder="Enter Group ID">
54
+ <input type="text" id="participantChatIdInput" placeholder="Enter Participant Chat ID">
55
+ </div>
56
+ <button id="setAdminButton">Set Group Admin</button>
57
+
58
+ <script>
59
+ document.getElementById('setAdminButton').addEventListener('click', function() {
60
+ const apiKey = document.getElementById('apiKeyInput').value;
61
+ const groupId = document.getElementById('groupIdInput').value;
62
+ const participantChatId = document.getElementById('participantChatIdInput').value;
63
+ if (!apiKey || !groupId || !participantChatId) {
64
+ alert('Please fill in all fields.');
65
+ return;
66
+ }
67
+ setGroupAdmin(apiKey, groupId, participantChatId);
68
+ });
69
+
70
+ async function setGroupAdmin(apiKey, groupId, participantChatId) {
71
+ const url = `https://api.green-api.com/waInstance1101952913/setGroupAdmin/${apiKey}`;
72
+ const payload = {
73
+ groupId: groupId,
74
+ participantChatId: participantChatId
75
+ };
76
+ const headers = {
77
+ 'Content-Type': 'application/json'
78
+ };
79
+ try {
80
+ const response = await fetch(url, {
81
+ method: 'POST',
82
+ headers: headers,
83
+ body: JSON.stringify(payload)
84
+ });
85
+ if (!response.ok) {
86
+ throw new Error(`HTTP error! status: ${response.status}`);
87
+ }
88
+ const data = await response.json();
89
+ console.log('Admin set successfully:', data);
90
+ alert('Admin set successfully!');
91
+ } catch (error) {
92
+ console.error('Error setting admin:', error);
93
+ alert('Error setting admin. Please check the console for details.');
94
+ }
95
+ }
96
+ </script>
97
+ </body>
98
+ </html>