React Ch WhatsApp

JavaScriptPublic
by zx-apiAug 27, 2026, 05:18 PMExpires: Never471 views
React Ch WhatsApp
Raw
1/**
2 * Mengirim reaksi ke WhatsApp Channel melalui API
3 * Description: Nih makan uy send React pesan saluran WhatsApp ๐Ÿ˜น
4 * Credit by Zx 
5 * Sumber: https://whatsapp.com/channel/0029VbDLqe7EquiSF4STU13o
6 * 
7 * Catatan: Kalau Mau Di Sher Lagi Pake Credit Atau sumber mas ๐Ÿ˜น
8 */
9 
10import { gotScraping } from 'got-scraping';
11const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
12
13/**
14 * @param {string} url - URL lengkap post WhatsApp Channel.
15 * @param {string[]} [reactions=['๐Ÿ˜‚']] - Array emoji yang dikirim.
16 * @param {number} [maxRetries=5] - Maksimal percobaan ulang jika gagal/rate limit.
17 */
18async function sendReaction(url, reactions = ['๐Ÿ˜‚'], maxRetries = 5) {
19  let attempt = 0;
20
21  while (attempt < maxRetries) {
22    try {
23      console.log(`[Attempt ${attempt + 1}/${maxRetries}] Mengirim reaction ke: ${url}`);
24      
25      const response = await gotScraping.post('https://react-w4.zfile.web.id/api/react', {
26        json: {
27          url: url,
28          reactions: reactions,
29        },
30        responseType: 'json',
31        timeout: { request: 60000 },
32      });
33
34      const data = response.body;
35
36      if (data.success) {
37        console.log(`โœ… Berhasil: ${data.message}`);
38        return data;
39      } else {
40        console.warn(`โš ๏ธ Gagal: ${data.message}`);
41        await delay(5000);
42        attempt++;
43      }
44    } catch (error) {
45      if (error.response) {
46        const data = error.response.body;
47        const statusCode = error.response.statusCode;
48        
49        console.warn(`โš ๏ธ HTTP Error ${statusCode}: ${data?.message || error.message}`);
50
51        if (statusCode === 429 && data?.retryAfter) {
52          const waitTime = data.retryAfter * 1000;
53          console.log(`โณ Rate limit tercapai. Menunggu ${data.retryAfter} detik sebelum retry...`);
54          await delay(waitTime);
55          attempt++;
56          continue;
57        }
58        
59        console.log('โณ Server sibuk, mencoba lagi dalam 5 detik...');
60        await delay(5000);
61        attempt++;
62        continue;
63      }
64      
65      console.error(`โŒ Error jaringan:`, error.message);
66      await delay(5000);
67      attempt++;
68    }
69  }
70
71  return null;
72}
73
74// CONTOH PENGGUNAAN
75const targetUrl = 'https://whatsapp.com/channel/0029VbDLqe7EquiSF4STU13o/451';
76const emojiReactions = ['๐Ÿ˜‚', '๐Ÿ‘', 'โค๏ธ'];
77
78sendReaction(targetUrl, emojiReactions);
78 linesยท2,430 charsยท2.4 KB