twilio - Send SMS from Google Sheet -
i got script send sms rows in google sheet using twilio example.
i want send sms acknowledgement customers below google sheet
https://docs.google.com/spreadsheets/d/1jpka0wn8cq6j6be8ks5vf-jj50ykdcumietrwjai7kw/edit?usp=sharing
i want sms go once customers whom status not starting "sent" , phone number starting "+91"
the sms this
complaint no "ser 160530" registered on "16/5/16" customer "tneb" due "ct failed". please call 18004257865 details
the message made of text , value cells in particular row "status" column must updated "sent sms xxxxxxxx on xxxx @ xx:xx:xx:xx" possible run script every 1 hour automatically? there free alternative send sms google sheet?
to execute script every hour can set time driven trigger. here documentation setting trigger.
here workaround sending texts out of google sheet free, might not work specific need, option:
every mobile phone carrier offers email sms option free. examples of these email addresses here. example if wanting text on sprint network attach phone number domain like: 13032223333@messaging.sprintpcs.com. if able collect or carrier phone numbers can set simple function connect 2 , use mail merge option 1 below send out texts. here documentation the mail merge mark sent messages , prevent multiple texts going out same contact.
// constant written in column c rows email // has been sent successfully. var email_sent = "email_sent"; function sendemails2() { var sheet = spreadsheetapp.getactivesheet(); var startrow = 2; // first row of data process var numrows = 2; // number of rows process // fetch range of cells a2:b3 var datarange = sheet.getrange(startrow, 1, numrows, 3) // fetch values each row in range. var data = datarange.getvalues(); (var = 0; < data.length; ++i) { var row = data[i]; var emailaddress = row[0]; // first column var message = row[1]; // second column var emailsent = row[2]; // third column if (emailsent != email_sent) { // prevents sending duplicates var subject = "sending emails spreadsheet"; mailapp.sendemail(emailaddress, subject, message); sheet.getrange(startrow + i, 3).setvalue(email_sent); // make sure cell updated right away in case script interrupted spreadsheetapp.flush(); } } }
Comments
Post a Comment