Lompat ke konten
View Categories

Integrasi Tally, Google sheet dan Whatsapp

Integrasi Tally, Google sheet dan Whatsapp (whacenter) Kirim pesan WA setelah isi form di tally

tool

Tally (form builder)
https://tally.so/

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

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

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

script
function onEditGo(e) {
  
  var range = e.range;
  var spreadSheet = e.source;
  var sheetName = spreadSheet.getActiveSheet().getName();
  var inputValue = e.value;
  var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
  var row = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1").getDataRange().getLastRow();
  var nama = ss.getRange(row,4).getValue();
  var hp =  ss.getRange(row,5).getValue();
  var email =  ss.getRange(row,6).getValue();
  var message = `terima kasih telah mengisi form berikut data anda
Nama : ${nama}
No WA : ${hp}
Email : ${email}`;
  
  if(sheetName == 'Sheet1')
  {  
   
        return sendWaText(hp,message);
    
  } 
}

var idDevice = "xxx"; //ganti dengan device id anda

function sendWaText(number,message){
  
var formdata = {
    "device_id" : ""+idDevice,
    "number" : ""+number,
    "message" : ""+message
  }

  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)


}

Powered by BetterDocs

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *