Send free SMS - multi source - multi language - CodyLab

CALL, SEND SMS, SEND WHATSAPP MESSAGE BY GOOGLE SCRIPT | MULTI SOURCE | MULTI LANGUAGE

In this article we are going to see how to:

  • Divert a number to calling screen with href and tel tag; like <a href="tel:+4733378901">+47 333 78 901</a>
  • Send sms from your local sms provider SIM. But get SMS body and contact number from Google sheet.
  • Send Whatsapp message from your Whatsapp app installed on your phone. But get message body and contact number from Google sheet.

This is the screenshot of the Google apps script webapp.

This is the screenshot of the Google apps script webapp.

Now have a look on the codes that have been used in this project. 
Make a copy of the code and paste it in your Google web project file.
index.html  

<!DOCTYPE html>
<html>
<title>USE ON PHONE</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" 
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<body>
 <h5 class="w3-red w3-center">
 USE THIS WEBAPP ON PHONE TO SEE HOW THIS WORKS</h5>
 <h6 class="w3-yellow w3-center">
 Send Whatsapp sms for free. Send whatsapp sms manually. 
But get data from google sheet automatically.</h6>
 <h6 class="w3-red w3-center">
 Multi-language .</h6>
<div class="w3-row-padding w3-border-bottom">
<div class="w3-col s5">
    <select id="smsl"class="w3-select w3-col s6"onchange="list()">
    <option value="en">SMS Language</option>
    <option value="en">English</option>
    <option value="hi">Hindi</option>
    <option value="ur">Urdu</option>
    <option value="pa">Punjabi</option>
    <option value="ar">Arbic</option>
    <option value="sd">Sindhi</option>
    </select>
    <select id="cls"onchange="list()"class="w3-select w3-col s3">
    <option value="">CLASS</option>
    <option value="I">I</option>
    <option value="II">II</option>
    <option value="III">III</option>
    <option value="IV">IV</option>
    <option value="V">V</optio>
    </select>
    <select id="typ" onchange="list()"class="w3-select w3-col s3">
    <option value="ALL">ALL</option>
    <option value="Advance">Advance</option>
    <option value="Dues">Dues</option>
    </select>
</div>
<div class="w3-col s1 w3-center">
<i id="spin" class="fa fa-refresh fa-0"onclick="list()" style="font-size:20px"></i>
</div>
<div class="w3-col s4 w3-left">
<i id="info"></i>
</div>
<div class="w3-col s1 w3-right">
<input type="button" name="btnprint" value="Print" 
onclick="pPrint('result')"class="w3-btn w3-teal w3-hover-red">
</div>
</div>
<div style="overflow: auto;height:520px;">
<div id="result"align="center"></div></div>
 <script>
    function list() {
     var cl   = document.getElementById('cls');
     var clv  = cl.options[cl.selectedIndex].value;
     var typ  = document.getElementById('typ');
     var tyv  = typ.options[typ.selectedIndex].value;
     var lan  = document.getElementById('smsl');
     var smsl  = lan.options[lan.selectedIndex].value;
     var spn  = document.getElementById('spin');
     var info = document.getElementById('info');
     var resu = document.getElementById('result');
     if(clv === ""){
     info.innerHTML = "";
     }else{
     function fail(error){
     resu.innerHTML = "<span style='color:red'>"+error+"</span>";
     spn.classList.remove('fa-spin');
     info.innerHTML = "";
     };
     function pass(list){
     resu.innerHTML = list;
     spn.classList.remove('fa-spin');
     var rc =document.getElementById('table').rows.length-1;
     info.innerHTML = rc+" Records found.";
     };
     resu.innerHTML = "";
     spn.classList.add('fa-spin');
     info.innerHTML = "Working on...";
     google.script.run.withFailureHandler(fail)
                      .withSuccessHandler(pass)
                      .iList(smsl,clv,tyv);}};

        </script>
</body>
</html>       


Code.gs      

function doGet(e) {
  return HtmlService.createTemplateFromFile('index').evaluate();
  }

function iList(smsl,clv,tyv){
var ws = SpreadsheetApp.openById("sheet id").getSheetByName("whatsapp");
var dl = ws.getDataRange().getValues();
var tb = "";
var hd ='<table id=table class="w3-table-all w3-hoverable"><tr class="w3-red">
<th>ID No.</th><th>Name</th><th>Village</th><th>Contact</th>
<th>Class & Sec</th><th>Balance</th><th>Contact Source</th></tr>';
for(var i=1i<dl.length ; i++){
if(tyv == "ALL") { var sv = dl[i][7]+"!=''";}elsevar sv = dl[i][7] == tyv;};
if(clv == dl[i][2] && sv){ 
  //set student detail
var user =  "[ID:"+dl[i][0]+", Class:"+dl[i][2]+"-"+dl[i][3]+"]";
// as default language 
if(smsl=="en"){   
var txt = "Dear "+dl[i][1].toUpperCase()+", Your total due ammount is "+
dl[i][6]+" Rs. Please pay your due soon. SCHOOL NAME.";
}else{
//translate in other language
var txt = LanguageApp.translate("Dear "+dl[i][1]+", Your total due ammount is "+
dl[i][6]+ " Rs. Please pay your due soon. SCHOOL NAME."'en'smsl);}
// icon show if user has submited mobile number
if(dl[i][5]!=""){
var wt = "<a class='fa fa-whatsapp w3-large' href='https://wa.me/91"+
dl[i][5]+"?text="+user+", "+txt+"' target='_blank'></a>";
var sm = "<a class='fa fa-comment  w3-large' href='sms:"+
dl[i][5]+"?&body="+user+", "+txt+"' target='_blank'></a>";
var cl = "<a class='fa fa-phone w3-large'    href='tel:+91"+
dl[i][5]+"' target='_blank'></a>"
}else{var wt = "!"sm="contact";cl="No";};
tb+="<tr><td><b>"+dl[i][0]+"</b></td><td>"+
dl[i][1]+"</td><td> "+dl[i][4]+"</td><td> "+dl[i][5]+"</td><td>"+dl[i][2]+
" - "+dl[i][3]+"</td><td> "+dl[i][6]+" "+dl[i][7]+"</td><td>"+
cl+"&nbsp;&nbsp;&nbsp;&nbsp;"+sm+"&nbsp;&nbsp;&nbsp;&nbsp;"+wt+"</td></tr>";}
};
return hd+tb;
}

>>>TRY TO CHECK OUT , IF ANY ERROR FOUND. PLEASE LET ME KNOW BY COMMENT. I'LL TRY MY LEVEL BEST TO FIX THE PROBLEM. THANKS FOR VISITING CODYLAB Have a nice day! -------------------------- -------------------------
Donate me through - PayPal or RozorPay or Paytm

Post a Comment

Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.