X

KIRIM BROADCAST PESAN WA DARI GOOGLE SPREADSHEET

Kirim broadcast pesan WA dari google spreadsheet

tool

google spreadsheet : https://docs.google.com/spreadsheets/

google apps script : https://script.google.com/

whatsapp api gateway : https://whacenter.com/

Script :

function sendWhatsAppMessages() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var dataRange = sheet.getDataRange();
  var data = dataRange.getValues();
  var date = new Date();
  var schedule = Utilities.formatDate(date, Session.getScriptTimeZone(), "yyyy-MM-dd HH:mm:ss");
  var startrow = sheet.getRange("G2").getValue();
  var endrow = sheet.getRange("G3").getValue();
  
  for (var i = startrow; i <= endrow; i++) {
    var row = data[i];
    var name = row[1];
    var phoneNumber = row[2]; // Kolom nomor telepon
    var message = row[3]; // Kolom pesan
    
    sendWaText(phoneNumber, message);
  }
}

function sendWaText(number, message) {
  var idDevice = "xxx"; // Ganti Device ID Anda
  
  var formdata = {
    "device_id" : "" + idDevice,
    "number" : "" + number,
    "message" : "" + message,
    //"schedule" : "" + schedule
  };

  var requestOptions = {
    method: 'POST',
    contentType: 'application/json',
    payload: JSON.stringify(formdata),
    redirect: 'follow'
  };

  var response = UrlFetchApp.fetch("https://app.whacenter.com/api/send", requestOptions);
  Logger.log(response);
}
adikiss: i'm just an ordinary person | Direktur PT. Adya Global Media | Telegram : <a href="https://t.me/adikiss">t.me/adikiss</a> | Whatsapp : <a href="https://wa.me/6285640206067">wa.me/6285640206067</a> | Facebook : <a href="https://fb.me/adikiswanto">fb.me/adikiswanto</a>
Related Post
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings