EASILY INTEGRATE FAST2SMS API AND SEND SMS | FAST2SMS API - JAVASCRPT APPS SCRIPT HTML - CodyLab

INTEGRATION OF FAST2SMS API IS EASY IN GOOGLE SCRIPT. WE CAN EASILY INTEGRATE IT AND SEND SMS TO ANY BODY WHOM WE WANT TO SEND.

EASILY INTEGRATE FAST2SMS API AND SEND SMS

                INTEGRATION OF FAST2SMS API IS EASY IN GOOGLE SCRIPT. WE CAN EASILY INTEGRATE IT AND SEND SMS TO ANY BODY WHOM WE WANT TO SEND. NO PROBLEM HOW WE WANT TO SEND IT BY AUTOMATION OR MANNUALLY. WE CAN SET IT UP AS WISH.
            WE CAN ALSO FETCH AND INCLUDE DATA THROUGH GOOGLE SHEET OR WRITE IN HTML INPUT AND SEND SEND TO SOME BODY,
LET'S SEE HOW CAN WE GOT DONE. 
    FIRST STEP                                                                          
        WE NEED TO MOVE TO GOOGLE SCRIPT PAGE. TO MOVE   CLICK HERE.
AND CREATE A NEW PROJECT .IN THIS PROJECT YOU GET A FILE NAME     Code.gs 
PASTE THE FOLLOWING CODE IN IT.

Code.gs

// Don't make any change in following code except  API KEY  
function doGet(e) {
  return HtmlService
    .createHtmlOutputFromFile('index.html')
    .setTitle("SEND SMS | FAST2SMS API | JAVASCRIPT | APPS SCRIPT");
}


function submitDT(obj){
  var  cont  = obj [ 0 ];
var  smsb  = obj [ 1 ];
  var apikey  = " Paste FAST2SMS API " ; 
  var url = "https://www.fast2sms.com/dev/bulkV2?authorization="
+apikey+"&sender_id=TXTIND&message="+smsb+"&route=v3&numbers="+cont+"";
  var options = {
  "async"true,
  "crossDomain"true,
  "method""GET"
}
  where response = UrlFetchApp.fetch(urloptions);
  where data = JSON.parse(response.getContentText())
  return data.message;
}



GET YOUR FAST2SMS API FROM FAST2SMS DASHBOARD>>DEV API. 
AND REPLACE IT IN RED MARK.

    SECOND STEP                                                                      
       CREATE A NEW HTML FILE AND NAME IT index.html 
AND PASTE THE FOLLOWING CODE IN IT.        

index.html 

<!DOCTYPE html>
<html>
  <head>
     <base target="_top" />
     <h2>SEND SMS | FAST2SMS API | JAVASCRIPT | APPS SCRIPT</h2>
     <style>
input,textarea {
  width: 40%;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box;
}
</style>
  </head>
  <body align="center">
    <div id="result"></div>
       <br>
    <input type="tel"id="number" placeholder="Mobile number"/>
      <br>  
    <textarea id="text" min="0" max="100" placeholder="Write massage here..."
 height="400px"></textarea>
      <br>  
    <input type="submit" value="SEND" onclick="sendSMS()"/>
    <script>
      function  sendSMS () {
        let number = document.querySelector('#number').value;
        let text = document.querySelector('#text').value;

         let dataList = [number,text];
         let updateLocation = document.querySelector('#result');

         function onFailure(error){
          let warning = `<span style="color:red">${error}</span>`;
          updateLocation.innerHTML = warning;

        };
        
        function  onSuccess(response){
          let result ="<span style='color:green'>"+response+"</span>";
          updateLocation.innerHTML = result;

        };
        google.script.run.withFailureHandler(onFailure)
                         .withSuccessHandler(onSuccess)
                         .submitDT(dataList);

      };
    </script>
  </body>
</html>

    THIRD  STEP                                                                      
SAVE THE FILE AND CLICK ON DEPLOY BUTTOB AND DEPLOY AS WEB APP.

ABOVE CODE LOOK LIKE THIS.

>>>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!
-------------------------- -------------------------

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.