Jump to content

Recommended Posts

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 )

image.png.197932549ec8a943dd3e735bbb1e0812.png

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
image.png.3b99040e17f25408d6fcf1240a908726.png

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 :
 

image.png.12b2e01f0206450ddeb1a31e3c749d8a.png

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 )

image.png.197932549ec8a943dd3e735bbb1e0812.png

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
image.png.3b99040e17f25408d6fcf1240a908726.png

Notes
 


 

Kalau kirim dengan list message bagaimana tuan?

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 )

image.png.197932549ec8a943dd3e735bbb1e0812.png

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
image.png.3b99040e17f25408d6fcf1240a908726.png

Notes
 


 

image.thumb.png.9e2bb217d95b67e6369df6e522b7aa35.png

 

function 6 otomatis ya 

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 :
 

image.png.12b2e01f0206450ddeb1a31e3c749d8a.png

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:

image.thumb.png.9e2bb217d95b67e6369df6e522b7aa35.png

 

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,

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

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

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

  • Like 1
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

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


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 🙏

50 minutes ago, Fud said:

Tidak bisa generate SSlScreenshot_2024-09-09-20-21-16-704_com.android.chrome-edit.thumb.jpg.82bf6d0d354ff5b3565b83e2feb266ff.jpg

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

@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.
  • Like 1
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 generateimage.thumb.png.469c03753171c03b02542d51746622e9.png

image.png

hi bro try to change theme to another theme, i face this issue too but after i change my theme its working.

 

Edited by Dewa IQOOZ7
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:
image.png.bed896f183583fe0762cefbc5599319c.png

  • Love 1
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 .

download - 2024-09-09T133523.153.png

download - 2024-09-09T035513.934.png


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

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

image.png.ec2a401abf66d52b556465c262637deb.png

Edited by kecoamumet
  • Like 1

@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

wsheet.jpg.b1a25516ac39374325eba53c0b89909e.jpg

 

2. then go to Extensions - Apps Script

appsscript.jpg.6ed7295ddac47fc78a363f1d113e9957.jpg

 

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

triggers.jpg.cf553ed27faf0ebcc6e40f9dffd666e5.jpg

 

5.  Click Add Trigger button in right bottom corner.

6.  make setting like picture bellow. click SAVE.

addtriger.jpg.053a6e898130aefe117adc67f4b4b4e7.jpg

 

7. Click DEPLOY in right top corner.

8. Select type: WEB APP. and make setting like picture. Click DEPLOY to finish it.

autowebhook.jpg.e2e67fa05cab4a05cba124d11bf07979.jpg

 

9. copy url and paste in your MPWA webhook. 

copyurl.jpg.581873383fcb7afc4a375c106be29699.jpg

 

 

@Enno The Explorer @JangE  thanks to @bloserda who teach me about this script.

Glad to hear that, lancar kang? 🥰

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...