【发布时间】:2020-11-12 03:44:34
【问题描述】:
如果有人填写我的谷歌表格,是否可以自动发送 WhatsApp 消息,目前将数据存储到谷歌表格中。在此表单中,用户填写他们的姓名和电话号码。我想在他们填写表格时自动向他们发送欢迎信息。在 App Script 的帮助下,我已经成功地以类似的谷歌表单发送了一封欢迎电子邮件。
这就是我在电子邮件中所做的:
function sendMail() {
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("CRM").activate()
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lr = ss.getLastRow();
var quotaLeft = MailApp.getRemainingDailyQuota();
// Logger.log(quotaLeft)
if((lr-1) > quotaLeft){
Browser.msgBox("You have only " + quotaLeft + " E-mail left, mails were not sent")
} else{
for(var i=2; i<=lr;i++){
var currentEmail = ss.getRange(i, 1).getValue();
var currentSub = ss.getRange(i, 3).getValue();
var currentName = ss.getRange(i, 2).getValue();
var templateText = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Templates").getRange(i, 2).getValue();
var name = templateText.replace("{name}", currentName);
MailApp.sendEmail(currentEmail, currentSub, name)
}
Browser.msgBox("Welcome emails sent")
}
}
【问题讨论】:
标签: javascript automation twilio whatsapp twilio-api