Enno The Explorer Posted September 9 Posted September 9 45 minutes ago, Pebrian said: SHARE QURAN VIA GOOGLE APPSCRIPT (Script quran.php dari mamank @Magd Almuntaser) Buka Google Spreadsheets lalu buat table seperti ini ( Your Website | Apikey | Sender | Tujuan | Text/Audio/Hybrid ) atau bisa copy dari ini : https://docs.google.com/spreadsheets/d/1ICpCKMOSFOxDDeipt71wDHakocBVFmQVrpmguHWcEkM/edit?usp=sharing lalu pergi ke Extensi -> AppScript lalu copas script ini ke appscript lalu save. 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 MessageTemplate = `*Ayat Alquran* {{arabic}} {{indonesia}} *(Qs. {{S}}:{{Q}})* *Tafsir (${TAFSIR}):* {{tafsir}} *Sedekah Jariyah*`; var Message = MessageTemplate.replace("{{arabic}}", arabic) .replace("{{indonesia}}", indonesia) .replace("{{Q}}", numberInSurah) .replace("{{S}}", surahNumber) .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()); } lalu tambahkan trigger sesuai kebutuhan kalian. contoh 15/30/60 menit sekali Jika pilih hybrid akan seperti ini Notes Masya Allah..Amaziing mas saran aja klo bisa penulisannya Ayat Al Quran | Surat: abx | Qs.01:01 sama buat pilihan terjemahan per Ayat bisa ga mas, sprt ini : Quote
pak kacung Posted September 9 Posted September 9 1 hour ago, Pebrian said: SHARE QURAN VIA GOOGLE APPSCRIPT (Script quran.php dari mamank @Magd Almuntaser) Buka Google Spreadsheets lalu buat table seperti ini ( Your Website | Apikey | Sender | Tujuan | Text/Audio/Hybrid ) atau bisa copy dari ini : https://docs.google.com/spreadsheets/d/1ICpCKMOSFOxDDeipt71wDHakocBVFmQVrpmguHWcEkM/edit?usp=sharing lalu pergi ke Extensi -> AppScript lalu copas script ini ke appscript lalu save. 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 MessageTemplate = `*Ayat Alquran* {{arabic}} {{indonesia}} *(Qs. {{S}}:{{Q}})* *Tafsir (${TAFSIR}):* {{tafsir}} *Sedekah Jariyah*`; var Message = MessageTemplate.replace("{{arabic}}", arabic) .replace("{{indonesia}}", indonesia) .replace("{{Q}}", numberInSurah) .replace("{{S}}", surahNumber) .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()); } lalu tambahkan trigger sesuai kebutuhan kalian. contoh 15/30/60 menit sekali Jika pilih hybrid akan seperti ini Notes Kalau kirim dengan list message bagaimana tuan? Quote
Bajra Al Faruq Posted September 9 Posted September 9 3 hours ago, Pebrian said: SHARE QURAN VIA GOOGLE APPSCRIPT (Script quran.php dari mamank @Magd Almuntaser) Buka Google Spreadsheets lalu buat table seperti ini ( Your Website | Apikey | Sender | Tujuan | Text/Audio/Hybrid ) atau bisa copy dari ini : https://docs.google.com/spreadsheets/d/1ICpCKMOSFOxDDeipt71wDHakocBVFmQVrpmguHWcEkM/edit?usp=sharing lalu pergi ke Extensi -> AppScript lalu copas script ini ke appscript lalu save. 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 MessageTemplate = `*Ayat Alquran* {{arabic}} {{indonesia}} *(Qs. {{S}}:{{Q}})* *Tafsir (${TAFSIR}):* {{tafsir}} *Sedekah Jariyah*`; var Message = MessageTemplate.replace("{{arabic}}", arabic) .replace("{{indonesia}}", indonesia) .replace("{{Q}}", numberInSurah) .replace("{{S}}", surahNumber) .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()); } lalu tambahkan trigger sesuai kebutuhan kalian. contoh 15/30/60 menit sekali Jika pilih hybrid akan seperti ini Notes function 6 otomatis ya Quote
Pebrian Posted September 9 Posted September 9 On 9/9/2024 at 3:53 PM, Enno The Explorer said: Masya Allah..Amaziing mas saran aja klo bisa penulisannya Ayat Al Quran | Surat: abx | Qs.01:01 sama buat pilihan terjemahan per Ayat bisa ga mas, sprt ini : noted revisi nanti untuk ayat | surrah | QS untuk perayat saat ini dari api nya tidak menyediakan On 9/9/2024 at 4:38 PM, pak kacung said: Kalau kirim dengan list message bagaimana tuan? list message nya bagaimana? surat 1 surat 2 apa gitu? belum coba saya mungkin bisa di kreasi sendiri On 9/9/2024 at 6:18 PM, Bajra Al Faruq said: function 6 otomatis ya untuk function 6 itu di generate otomatis /random, karna saya mengambil api nya random, dan setiap nomor yang tertempel pada "Tujuan" akan di generate satu per satu, agar menghindari spam whatsapp, Quote
Magd Almuntaser Posted September 9 Author Posted September 9 2 minutes ago, Pebrian said: noted revisi nanti untuk ayat | surrah | QS untuk perayat saat ini dari api nya tidak menyediakan list message nya bagaimana? surat 1 surat 2 apa gitu? belum coba saya mungkin bisa di kreasi sendiri untuk function 6 itu di generate otomatis /random, karna saya mengambil api nya random, dan setiap nomor yang tertempel pada "Tujuan" akan di generate satu per satu, agar menghindari spam whatsapp, I have done with murasaki for them via php you can use it and convert it to appscript quran.php Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
Magd Almuntaser Posted September 9 Author Posted September 9 3 hours ago, Enno The Explorer said: Masya Allah..Amaziing mas saran aja klo bisa penulisannya Ayat Al Quran | Surat: abx | Qs.01:01 sama buat pilihan terjemahan per Ayat bisa ga mas, sprt ini : Why do you want to use appscript when the file is ready php just put it in cronjob and it will work Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
Gusik Prasetyo Posted September 9 Posted September 9 4 minutes ago, Magd Almuntaser said: Why do you want to use appscript when the file is ready php just put it in cronjob and it will work Mas @Enno The Explorer is appscript geek so he will try all about appscript 2 Quote
Pebrian Posted September 9 Posted September 9 On 9/9/2024 at 7:22 PM, Magd Almuntaser said: I have done with murasaki for them via php you can use it and convert it to appscript quran.php 21.38 kB · 0 downloads 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 mybe next time I migrate this all source to my storage, because full surahs in api not working thanks my friend @Magd Almuntaser 1 Quote
Magd Almuntaser Posted September 9 Author Posted September 9 4 minutes 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 mybe next time I migrate this all source to my storage, because full surahs in api not working thanks my friend @Magd Almuntaser put the codes in a file and attach it to the attachments so that your comment does not take too long Thank you for your effort Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
Pebrian Posted September 9 Posted September 9 On 9/9/2024 at 7:40 PM, Magd Almuntaser said: put the codes in a file and attach it to the attachments so that your comment does not take too long Thank you for your effort your welcome bro. In some surahs from archive org, api could not get them, because the repository may be dead.. https://quran-api-id.vercel.app/surahs, Quote
Magd Almuntaser Posted September 9 Author Posted September 9 50 minutes ago, Fud said: Tidak bisa generate SSl Yes, sometimes the service does not work with everyone, this depends on what Let's Encrypt agrees with.. My programming when you press the generate button requests a certificate from Let's Encrypt, and they are the main controllers of approval or rejection You can create SSL manually for free. You can enter in Google (ssl free) and more than one site will appear that offers SSL for free. After that, you can follow pages 40 and 41 for how to install the certificate Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
Abdulrahman Mohamed Posted September 9 Posted September 9 @Magd Almuntaser I have two questions: 1- Sometimes when using the QR-Code API for a number I’ve used before, it gives me an invalid data error. And to connect with the same number, it doesn't work. The user had to add the number manually and, for example, change the last digit. That was my first question. 2- I have a website that uses mpwa v5, and it’s working fine, but I want to upgrade to the latest version mpwa v8. I want to migrate the same user data and keep the numbers connected. So, I’m supposed to take the database and adjust it to be compatible with the latest version. However, the users' connected devices are not remaining connected. What are the folders that I should take and transfer? Here are some updates that may be useful in the next version : Create an API for creating campaigns with a list of numbers And another API for returning a campaign report information . In planning system , add an option for each plan to set a limit on daily or monthly messages, or make it unlimited. 1 Quote
suryadewa Posted September 9 Posted September 9 (edited) On 9/6/2024 at 5:05 PM, Getthecodenow said: @Unicode now node connected but show waiting for node server on whatsapp connect QR not generate hi bro try to change theme to another theme, i face this issue too but after i change my theme its working. Edited September 9 by Dewa IQOOZ7 Quote
Magd Almuntaser Posted September 9 Author Posted September 9 1 hour ago, Abdulrahman Mohamed said: @Magd Almuntaser I have two questions: 1- Sometimes when using the QR-Code API for a number I’ve used before, it gives me an invalid data error. And to connect with the same number, it doesn't work. The user had to add the number manually and, for example, change the last digit. That was my first question. 2- I have a website that uses mpwa v5, and it’s working fine, but I want to upgrade to the latest version mpwa v8. I want to migrate the same user data and keep the numbers connected. So, I’m supposed to take the database and adjust it to be compatible with the latest version. However, the users' connected devices are not remaining connected. What are the folders that I should take and transfer? Here are some updates that may be useful in the next version : Create an API for creating campaigns with a list of numbers And another API for returning a campaign report information . In planning system , add an option for each plan to set a limit on daily or monthly messages, or make it unlimited. 1- I think the number is logged out when trying to register a number that has already been registered .. I will review this issue. 2- you can transfer from 5v to 8.0.5 with these steps: First: Make a backup of the entire previous script in case of any problems. Secondly: make a backup of the (credentials) folder and the (.env) file. Third: Remove the previous script files and upload the new version 8.0.5 and unzip it.. and return the credentials folder and the .env file. Fourth: You must transfer the new variables from the new .env file to the existing .env file because there are new variables such as THEME_NAME and CHATGPT_URL, etc. Sixth: This is the most important step. Open the following link in a browser until the number 0 appears. This way you will have updated your version: http://yoursite.com/migrate http://yoursite.com/storage-link Note: If you see that there is a problem and it tells you that you need to scan the QR, you should change the APP_NAME to the old name in the old .env file and replace the credentials folder again. As for the features: Yes, I will do (create campaigns) via the API, and it is in my plan to use it in the plugins that I will develop for WordPress and WHMCS. However, it will be complicated to use unless you are a programmer who will know how to use it because you will use media, text, vcard, etc. through it, and it will be POST, not GET. Therefore, until now, I have not developed it, but it is in the plan. Yes, I will set a limit for devices and the number of messages allowed for each number..and activate and deactivate features such as sending a normal message, a media message, etc.. Yes, there will be complete control over the plans so that the admin can set appropriate plans for his users. 49 minutes ago, Dewa IQOOZ7 said: hi bro try to change theme to another theme, i face this issue too but after i change my theme its working. btw sorry i want to ask, how to get api_key from user setting: 1 Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
Owias Posted September 9 Posted September 9 QR Code not shown, just loading... Even Node.js was created with NPM. There is any new Tutorial to install this script. You tube have old version tutorial. In this version, the PORT disconnect issue shown . Quote
Magd Almuntaser Posted September 9 Author Posted September 9 11 minutes ago, Owias said: QR Code not shown, just loading... Even Node.js was created with NPM. There is any new Tutorial to install this script. You tube have old version tutorial. In this version, the PORT disconnect issue shown . edit .env file: APP_URL=http://yoursite.com WA_URL_SERVER=http://yoursite.com:3100 TYPE_SERVER=other and make sure you enter http not https .. and try restart nodejs Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
Owias Posted September 9 Posted September 9 Same issue. I have tried everything. Can you install it for me. or do you have any Authantic tutorial? There are 2 directries auto created in root side. I think so there is node js app issue or director issue. Quote
Magd Almuntaser Posted September 9 Author Posted September 9 8 minutes ago, Owias said: Same issue. I have tried everything. Can you install it for me. or do you have any Authantic tutorial? There are 2 directries auto created in root side. I think so there is node js app issue or director issue. Ok send you details DM Quote Update Whatsapp Gateway Multi Device (Magd Version) v8.0.0
Enno The Explorer Posted September 9 Posted September 9 10 hours ago, Magd Almuntaser said: Why do you want to use appscript when the file is ready php just put it in cronjob and it will work Just experiment mr..akan menyenangkan bisa belajar banyak Quote
kecoamumet Posted September 10 Posted September 10 11 hours ago, Magd Almuntaser said: I have done with murasaki for them via php you can use it and convert it to appscript quran.php 21.38 kB · 6 downloads luar biasa masbro.. semoga menjadi ladang pahala amal jariyah aamiin... Quote
Jei Grey Posted September 10 Posted September 10 12 hours ago, Magd Almuntaser said: I have done with murasaki for them via php you can use it and convert it to appscript quran.php 21.38 kB · 12 downloads pakai script ini jika penerima ada 3 nomor,pesan langsung terkirim ke 3 nomor sekaligus dengan isi pesan yang sama. apakah bisa dibuat ada delay antar nomor dan pesan yang terkirim acak (tidak sama) terima kasih sebelumnya mr. @Magd Almuntaser Quote
kecoamumet Posted September 10 Posted September 10 (edited) 1 hour ago, Jei Grey said: pakai script ini jika penerima ada 3 nomor,pesan langsung terkirim ke 3 nomor sekaligus dengan isi pesan yang sama. apakah bisa dibuat ada delay antar nomor dan pesan yang terkirim acak (tidak sama) terima kasih sebelumnya mr. @Magd Almuntaser iya. baru juga mau komen yang sama. jadi +1 aja sekalian tambahkan hadits juga bang @Magd Almuntaser kalau utk delay @Jei Grey tinggal tambahkan sleep aja Edited September 10 by kecoamumet 1 Quote
bloserda Posted September 10 Posted September 10 @Gusik Prasetyo On 8/25/2024 at 6:22 PM, Gusik Prasetyo said: this tutorial to make MPWA autoreply using google sheet plus apps script. 1. make new sheet file using this format (1st row) Keyword, Type, Message, File you can visit: https://docs.google.com/spreadsheets/d/1svHPPF3hFyaPfkRxzN1wscR5A5bS21MzcjrH3NO51us/edit?usp=sharing 2. then go to Extensions - Apps Script 3. delete all data on there. copy and paste code bellow. and edit with your own data. function doPost(e) { var data = e.postData.contents; var json = JSON.parse(data); var number = json['from']; var senderMessage = json['message']; var file = json['bufferImage']; var pesan = senderMessage.toLowerCase(); var newMessage = pesan.split(" "); var searchreply = autoreply(newMessage[0]); var type = searchreply[1]; var messagetosend = searchreply[2]; var file = searchreply[3]; if(type == "file"){ sendWaFile(number, messagetosend, file); } else if(type == "button") { sendWaButton(number, messagetosend, file); } else if(type == "list") { sendWaList(number, messagetosend, file); } else { sendWaText(number, messagetosend); } } function autoreply(message){ var sheetUrl = "https://docs.google.com/spreadsheets/d/1svHPPF3hFyaPfkRxzN1wscR5A5bS2jsdhjsdhuheheh/edit?usp=sharing"; //ganti dengan URL sheet kamu var sheetfile = SpreadsheetApp.openByUrl(sheetUrl); var sheet = sheetfile.getSheetByName("autoreply"); //sesuaikan dengan nama sheet yg d buat var data = sheet.getDataRange().getValues() var filterData = data.filter(function(keyword){ if(keyword[0] == message){ return keyword } }) if(filterData.length>0){ return filterData[0] } } function sendWaText(number, messagetosend) { var APIKey = "Hcu8aDaGnxI6Utf9kWjQsjlpX5taFy" //ganti dengan API var sender = "628xxxxxxxxxx" // ganti nomer HP var url = "https://websitekamu/send-message"; //ganti website var msgtext = { 'api_key': APIKey, 'sender': sender, "number": number, 'message': messagetosend, }; var response = UrlFetchApp.fetch(url, { "method": "POST", "contentType": "application/json", "payload" : JSON.stringify(msgtext), }); Logger.log(response.getContentText()); } //untuk kirim file function sendWaFile(number, messagetosend, file){ var APIKey = "Hcu8aDaGnxI6Utf9kWjQsjlpX5taFy" //ganti api var sender = "628000000000" // ganti nomer HP var url = "https://websitekamu/send-media"; //ganti website var msggmbr = { "api_key": APIKey, "sender": sender, "number": number, "media_type" : "image", "caption": messagetosend, "url": file } var response = UrlFetchApp.fetch(url, { "method": "POST", "contentType": "application/json", "payload" : JSON.stringify(msggmbr), }); Logger.log(response.getContentText()); } //fungsi button tidak bisa //http://yourhost.com/send-button?sender=nomersender&api_key=yourapikey&number=nomertujuan&url=&footer=optional&message=Halo,ini pesan button&button=button 1,button 2,button 3 function sendWaButton(number, messagetosend, file){ //var APIKey = "blablabla" //var sender = "blablabla" var url = "https://alamatwebsite/send-button"; var msgbut = { "sender" : sender, "api_key" : APIKey, "number" : number, "url" : null, "footer" : "optional", "message" : messagetosend, "button" : file } var response = UrlFetchApp.fetch(url, { "method": "POST", "contentType": "application/json", "payload" : JSON.stringify(msgbut), }); Logger.log(response.getContentText()); } 4. in left menus, choose Triggers 5. Click Add Trigger button in right bottom corner. 6. make setting like picture bellow. click SAVE. 7. Click DEPLOY in right top corner. 8. Select type: WEB APP. and make setting like picture. Click DEPLOY to finish it. 9. copy url and paste in your MPWA webhook. @Enno The Explorer @JangE thanks to @bloserda who teach me about this script. Glad to hear that, lancar kang? Quote
bloserda Posted September 10 Posted September 10 OMG, sudah 128 aja, thread gak ada matinya Apakah saya melewatkan sesuatu yang baru? Quote
Recommended Posts
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.