Jump to content

Recommended Posts

15 hours ago, Pebrian said:

thanks bro. i convert to appscript

Update Script

function sendQuranMessage() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var YOUR_WEBSITE = sheet.getRange('A2').getValue();
  var API = sheet.getRange('B2').getValue();
  var YOUR_NUMBER = sheet.getRange('C2').getValue();
  var AUDIO = sheet.getRange('E2').getValue();
  
  var dataRange = sheet.getRange(2, 4, sheet.getLastRow() - 1, 1);
  var ALL_NUMBERS = dataRange.getValues();

  var TAFSIR = "kemenag";
  var SHAIKH = "alafasy";

  ALL_NUMBERS.forEach(function(row, index) {
    var number = row[0];
    number = String(number).trim();
    
    var randomAyat = getAyatFromAPI();
    
    Logger.log(randomAyat);
  
    var arabic = randomAyat.arab;
    var indonesia = randomAyat.translation;
    
    var surahNumber = randomAyat.number && randomAyat.number.inSurah ? randomAyat.number.inSurah : 'Unknown Surah';
    var numberInSurah = randomAyat.number && randomAyat.number.inQuran ? randomAyat.number.inQuran : 'Unknown Ayat';
  
    var tafsirQuran = randomAyat.tafsir && randomAyat.tafsir[TAFSIR] && randomAyat.tafsir[TAFSIR].short 
      ? randomAyat.tafsir[TAFSIR].short 
      : 'Tafsir tidak tersedia';
  
    var audioUrl = randomAyat.audio[SHAIKH];
    
    var surahName = getSurahName(surahNumber);
  
    var MessageTemplate = `*Ayat Al Quran | Surat: ${surahName} | Qs: ${surahNumber}:${numberInSurah}*

    {{arabic}}

    {{indonesia}}

    *Tafsir (${TAFSIR}):*
    {{tafsir}}

    *Sedekah Jariyah*`;
    
    var Message = MessageTemplate.replace("{{arabic}}", arabic)
                                 .replace("{{indonesia}}", indonesia)
                                 .replace("{{tafsir}}", tafsirQuran);
    
    if (AUDIO == 2) {
      Logger.log("Mengirim Teks ke nomor: " + number);
      Logger.log("Pesan Teks: " + Message);
      sendTextMessage(YOUR_WEBSITE, API, YOUR_NUMBER, number, Message);
      
      Logger.log("Mengirim Audio ke nomor: " + number);
      Logger.log("URL Audio: " + audioUrl);
      sendAudioMessage(YOUR_WEBSITE, API, YOUR_NUMBER, number, audioUrl);
      
    } else if (AUDIO == 1) {
      Logger.log("Mengirim Audio ke nomor: " + number);
      Logger.log("URL Audio: " + audioUrl);
      sendAudioMessage(YOUR_WEBSITE, API, YOUR_NUMBER, number, audioUrl);
      
    } else {
      Logger.log("Mengirim Teks ke nomor: " + number);
      Logger.log("Pesan Teks: " + Message);
      sendTextMessage(YOUR_WEBSITE, API, YOUR_NUMBER, number, Message);
    }

    Utilities.sleep(2000);
  });
}

function getAyatFromAPI() {
  var url = "https://quran-api-id.vercel.app/random";
  var response = UrlFetchApp.fetch(url);
  var data = JSON.parse(response.getContentText());
  
  Logger.log(data);
  
  return data;
}

function sendTextMessage(YOUR_WEBSITE, API, sender, number, message) {
  var url = YOUR_WEBSITE + "/send-message";
  var payload = {
    'api_key': API,
    'number': number,
    'sender': sender,
    'message': message
  };
  
  var options = {
    'method': 'POST',
    'contentType': 'application/json',
    'payload': JSON.stringify(payload),
    'muteHttpExceptions': true
  };
  
  var response = UrlFetchApp.fetch(url, options);
  Logger.log("Response from server: " + response.getContentText());
}

function sendAudioMessage(YOUR_WEBSITE, API, sender, number, audioUrl) {
  var url = YOUR_WEBSITE + "/send-media";
  var payload = {
    'api_key': API,
    'number': number,
    'sender': sender,
    'media_type': 'audio',
    'caption': '',
    'url': audioUrl
  };
  
  var options = {
    'method': 'POST',
    'contentType': 'application/json',
    'payload': JSON.stringify(payload),
    'muteHttpExceptions': true
  };
  
  var response = UrlFetchApp.fetch(url, options);
  Logger.log("Response from server: " + response.getContentText());
}

function getSurahName(surahNumber) {
  var surahList = {
    1: 'Al-Fatiha',
    2: 'Al-Baqara',
    3: 'Aal-e-Imran',
    4: 'An-Nisa',
    5: 'Al-Maeda',
    6: 'Al-Anaam',
    7: 'Al-Araf',
    8: 'Al-Anfal',
    9: 'At-Taubah',
    10: 'Yunus',
    11: 'Hud',
    12: 'Yusuf',
    13: 'Ar-Rad',
    14: 'Ibrahim',
    15: 'Al-Hijr',
    16: 'An-Nahl',
    17: 'Al-Isra',
    18: 'Al-Kahf',
    19: 'Maryam',
    20: 'Taha',
    21: 'Al-Anbiya',
    22: 'Al-Hajj',
    23: 'Al-Mumenoon',
    24: 'An-Noor',
    25: 'Al-Furqan',
    26: 'Ash-Shuara',
    27: 'An-Naml',
    28: 'Al-Qasas',
    29: 'Al-Ankaboot',
    30: 'Ar-Room',
    31: 'Luqman',
    32: 'As-Sajda',
    33: 'Al-Ahzab',
    34: 'Saba',
    35: 'Fatir',
    36: 'Ya Seen',
    37: 'As-Saaffat',
    38: 'Sad',
    39: 'Az-Zumar',
    40: 'Ghafir',
    41: 'Fussilat',
    42: 'Ash-Shura',
    43: 'Az-Zukhruf',
    44: 'Ad-Dukhan',
    45: 'Al-Jathiya',
    46: 'Al-Ahqaf',
    47: 'Muhammad',
    48: 'Al-Fath',
    49: 'Al-Hujraat',
    50: 'Qaf',
    51: 'Adh-Dhariyat',
    52: 'At-Tur',
    53: 'An-Najm',
    54: 'Al-Qamar',
    55: 'Al-Rahman',
    56: 'Al-Waqia',
    57: 'Al-Hadid',
    58: 'Al-Mujadila',
    59: 'Al-Hashr',
    60: 'Al-Mumtahina',
    61: 'As-Saff',
    62: 'Al-Jumua',
    63: 'Al-Munafiqoon',
    64: 'At-Taghabun',
    65: 'At-Talaq',
    66: 'At-Tahrim',
    67: 'Al-Mulk',
    68: 'Al-Qalam',
    69: 'Al-Haaqqa',
    70: 'Al-Maarij',
    71: 'Nooh',
    72: 'Al-Jinn',
    73: 'Al-Muzzammil',
    74: 'Al-Muddathir',
    75: 'Al-Qiyama',
    76: 'Al-Insan',
    77: 'Al-Mursalat',
    78: 'An-Naba',
    79: 'An-Naziat',
    80: 'Abasa',
    81: 'At-Takwir',
    82: 'AL-Infitar',
    83: 'Al-Mutaffifin',
    84: 'Al-Inshiqaq',
    85: 'Al-Burooj',
    86: 'At-Tariq',
    87: 'Al-Ala',
    88: 'Al-Ghashiya',
    89: 'Al-Fajr',
    90: 'Al-Balad',
    91: 'Ash-Shams',
    92: 'Al-Lail',
     93: 'Ad-Dhuha',
     94: 'Al-Inshirah',
     95: 'At-Tin',
     96: 'Al-Alaq',
     97: 'Al-Qadr',
     98: 'Al-Bayyina',
     99: 'Al-Zalzala',
    100: 'Al-Adiyat',
    101: 'Al-Qaria',
    102: 'At-Takathur',
    103: 'Al-Asr',
    104: 'Al-Humaza',
    105: 'Al-fil',
    106: 'Quraish',
    107: 'Al-Maun',
    108: 'Al-Kauther',
    109: 'Al-Kafiroon',
    110: 'An-Nasr',
    111: 'Al-Masadd',
    112: 'Al-Ikhlas',
    113: 'Al-Falaq',
    114: 'An-Nas'
  };

  return surahList[surahNumber] || 'Unknown Surah';
}


Added Delay 2 Second before send next number
Added Title (Ayat Al Quran | Surahs $Title | Qs Title

image.png.8c3e1f2ad27c6a5dfcd285bcd0572366.png


mybe next time I migrate this all source to my storage, because full surahs in api not working

 

thanks my friend @Magd Almuntaser

Amazing Nice...😍👍👍👍

Hello can anyone help me..?
I have installed according to the instructions, but only a few moments after connecting then wa disconnected
Is there an error in my server.js script
Please share if anyone has a stable server.js
I am using Version v8.0.5 node: v20 (share hosting)

3 minutes ago, mdis said:

Hello can anyone help me..?
I have installed according to the instructions, but only a few moments after connecting then wa disconnected
Is there an error in my server.js script
Please share if anyone has a stable server.js
I am using Version v8.0.5 node: v20 (share hosting)

Does you add cron job?

 

every 1 min:
curl "https://yoursite/blast-start" >/dev/null 2>&1

every 1 min:
curl "https://yoursite/schedule-run" >/dev/null 2>&1

every 1 min:
curl "https://yoursite/schedule-cron" >/dev/null 2>&1

 

Edited by Unicode

@Unicode Yes, of course
I have run it step by step, but the connection is often lost
However, if I create a cronjob to send messages continuously via the API every minute, everything runs well. Is there an error in the server.js script? Please share it with me if anyone has a server.js modification.

Edited by mdis
2 minutes ago, mdis said:

@Unicode Yes, of course
I have run it step by step, but the connection is often lost
However, if I create a cronjob to send messages continuously via the API every minute, everything runs well. Is there an error in the server.js script? Please share it with me if anyone has a server.js modification.

I also got same issues.

always need to refresh connect with QR, refresh until my whatsapp profile picture shown again.

 

1 minute ago, Unicode said:

I also got same issues.

always need to refresh connect with QR, refresh until my whatsapp profile picture shown again.

 

If without cronjob send messages per minute via API the connection is often lost and I have to restart my node.js
Is this happening because I am using shared hosting or is there an error in the script,
If anyone has a stable script please share it with me
thank you

2 minutes ago, mdis said:

If without cronjob send messages per minute via API the connection is often lost and I have to restart my node.js
Is this happening because I am using shared hosting or is there an error in the script,
If anyone has a stable script please share it with me
thank you

I have try another whatsapp gateway and not found a wa gateway with rich feature.

Lets wait new update maybe will be nice

On 9/5/2024 at 8:56 PM, Enno The Explorer said:

Reset Password : Success 💚
**********************************************

File Manager : Success 💚
**********************************************

Export Phonebook : Success 💚
**********************************************

Campaign Snacked Admin (Theme) : Succes 💚
Campaign Eres & Eres Compact (Theme) : Success 💚
**********************************************

Text Message : Success 💚
Media Message : Success 💚
Poll Message : Success 💚
List Message : Success 💚
Location Message : Success 💚
Vcard Message : Success 💚
**********************************************

Automatically delete message history : Success 💚
**********************************************
Auto Replay Message (All Function): Success 💚
**********************************************
Api Test Message (All Function) : Success 💚
**********************************************
AI BOT One Bot (All Function): Success 💚
AI BOT Multi Bot (All Function): Success 💚
**********************************************
Webhook (All Function): Success 💚
**********************************************

Mpwa : v8.0.5
Node.js : v20
Php : v8.2
Server.js : Modifikasi
Cronjob : Tidak ada

Mulai : 

Tgl 05/09/24 Jam 10.02 
s.d
Tgl 05/09/24 Jam 10.42 
Durasi = +- 40 menit 
Tes : Pesan Api 1x 
Hasil : Success & Still Online 💚

Tgl 05/09/24 Jam 10.42 
sd 
Tgl 05/09/24 Jam 13.50 
Durasi = +- 2 Jam 
Tes : Pesan Api 1x 
Hasil : Success & Still Online 💚

Tgl 05/09/24 Jam 13.50 
sd 
Tgl 05/09/24 Jam 19.11
Durasi = +- 5 jam 
Tes : Pesan Api 1x 
Hasil : Success & Still Online 💚

Tgl 05/09/24 Jam 19.11 
sd 
Tgl 06/09/24 Jam 05.11
Durasi : Target +- 10 Jam ⚠️
Tes : Belum dilakukan ⚠️
Hasil : Belum diketahui ⚠️

I see this uses a modified Server.js, and it seems to be online for quite a while, can you share the server.js script?

@Unicode Have you ever tried this one?

5 minutes ago, mdis said:

If without cronjob send messages per minute via API the connection is often lost and I have to restart my node.js
Is this happening because I am using shared hosting or is there an error in the script,
If anyone has a stable script please share it with me
thank you

Some shared hosting will disconected the socket, why? because it is considered an anomaly on their log. So the solution is you must setup the cronjob on periodik time (1 hour/ 30 minutes) to restart the node js.

Next you must upgrade to the VPS for stable the sockets (spesially whiskey/baileys). I have been connected with MPWA version for 3 weeks with VM, not shared hossting.

Maybe this help you.

4 minutes ago, MURASAKI. said:

Some shared hosting will disconected the socket, why? because it is considered an anomaly on their log. So the solution is you must setup the cronjob on periodik time (1 hour/ 30 minutes) to restart the node js.

Next you must upgrade to the VPS for stable the sockets (spesially whiskey/baileys). I have been connected with MPWA version for 3 weeks with VM, not shared hossting.

Maybe this help you.

Can you tell me, how is cronjob command for restart node js on shared hosting?

 

7 minutes ago, Ilhamstore said:

@Magd Almuntaser

I found an anomaly in the "LIST MESSAGE" feature in the auto-reply section. I've already set the "Only reply when sender is" to "All", but it's not working on Android when accessed via group. However, it works fine when accessed personally. The problem is only in the Group.

Could you please explain this?

Yes, the problem has been fixed in the next version. The reason is that WhatsApp has modified its encryption method for some numbers. It has been modified in the next version.

  • Love 1
53 minutes ago, mdis said:

Can anyone tell me, how to use cronjob command to restart node.js on shared hosting?

This is how I use "Cron Jobs" settings on shared hosting:

  • /usr/local/bin/php /path-your-porject/artisan schedule:run >/dev/null 2>&1
  • /usr/local/bin/php /path-your-porject/artisan start:blast >/dev/null 2>&1
  • /usr/local/bin/php /path-your-porject/artisan subscription:check >/dev/null 2>&1

Please replace (/path-your-porject/) with your actual directory path. As long as I've been using this on shared hosting, everything has been running smoothly so far.

10 minutes ago, Ilhamstore said:

This is how I use "Cron Jobs" settings on shared hosting:

  • /usr/local/bin/php /path-your-porject/artisan schedule:run >/dev/null 2>&1
  • /usr/local/bin/php /path-your-porject/artisan start:blast >/dev/null 2>&1
  • /usr/local/bin/php /path-your-porject/artisan subscription:check >/dev/null 2>&1

Please replace (/path-your-porject/) with your actual directory path. As long as I've been using this on shared hosting, everything has been running smoothly so far.

  • /usr/local/bin/php /path-your-porject/artisan subscription:check >/dev/null 2>&1 . khusus ini utk apa ya om?
29 minutes ago, Ilhamstore said:

Berikut cara saya menggunakan pengaturan "Cron Jobs" pada shared hosting:

  • /usr/local/bin/php /path-your-porject/artisan jadwal: jalankan >/dev/null 2>&1
  • /usr/local/bin/php /path-proyek-anda/artisan mulai: blast >/dev/null 2>&1
  • /usr/local/bin/php /path-your-porje ct/langganan artisan: periksa >/dev/null 2>&1

Harap ganti (/path-your-porject/) dengan jalur direktori Anda yang sebenarnya. Selama saya menggunakan ini di shared hosting, semuanya berjalan lancar sejauh ini.

This is run every few minutes or hours ..?

Edited by mdis

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
  • Create New...