Send SMS using apps script/ google script - fast2sms API
Friends, we are going to tell you about SMS API impliment in apps script/ google script.
There are many SMS provider companies availabale like textlocal.in, twilio.com etc, But, I am here going to tell you how can you use fast2sms API in your apps script /google script web app and send sms by mannually or automation flows.
To get this done, we should need Fast2Sms API.
If you already have got Fast2sms API, move to step 1 else see: How to get Fast2SMS API?
Friends first of all go to Fast2sms.com and sign up or if you already signed up, got your api key from fast2sms dashboard.
You got some Rupees as bonus that you can use for testing that it's really works or not.
Step-1
After getting your API from Fast2Sms.com, make a copy of following code.
function sendSMS() {
// sms : SMS Body, content information you want to send.
var sms ="Your SMS goes here.";
// cont : content the contact numbers without contry code or 0.
// seprate each number by comma.
var cont ="1234567890,9876543210";
//apiv: content your fast2sms api key.
var apiv ="paste your api here";//
//Don't make any change in following code.
var sen_Id = "TXTIND";
var url = "https://www.fast2sms.com/dev/bulkV2?authorization="+apiv+"&sender_id="+sen_Id+"&message="+sms+"&route=v3&numbers="+cont+"";
var options = {
"async": true,
"crossDomain": true,
"method": "GET"
}
var response = UrlFetchApp.fetch(url, options);
Logger.log(response.getContentText());
}
Step-2
Now, Move to script.google.com And Click + Icon Create new Project Button.
Step-3
Now Paste your code like following example.
And rename your Project .
//Don't forget to paste your fast2Sms API code.
// Replace the mobile number
Now tap on Run function to see result.
| CodyLab Blogger CodyLab Blogger |
Have a nice day!
-------------------------- -------------------------
-------------------------- -------------------------