API SMS MASKING | API URL SMS OTP – TCASTSMS menyediakan gateway SMS untuk SMS One Time Password, SMS Verifikasi, SMS Notifikasi untuk Two Step Verification keamanan Aplikasi Web dan Mobile Apps Anda dimana pada dokumen ini khusus untuk SMS identitas yang muncul dipenerima berupa Masking Alpha Sender ID Nama Perusahaan.
SMS ini yang muncul di penerima berupa huruf maksimal 11 karakter dapat dengan Nama Perusahaan atau Nama Merek. Anda dapat menggunakan 2 (dua) tipe koneksi yaitu HTTP API dan SMPP Client. Sistem ini juga menyediakan Dashboard untuk melihat status laporan pengiriman SMS dan mendownload Laporan Pengiriman per bulannya dalam format Excel langsung.
API URL SMS OTP ini dapat diakses secara online dan tidak dikenakan biaya untuk dapat akses sms api online. TCASTSMS selaku vendor SMS Masking API hanya mencharge biaya SMS otp yang dikirimkan via API URL.
Dibawah ini adalah Contoh Script, Dokumentasi HTTP API, dan Screenshoot Dashboard
DOKUMEN API SMS MASKING”
Dokumentasi lengkap API SMS Masking ada pada menu DEVELOPER API
atau bisa simulasi API Tools klik swagger.tcastsms.net
Contoh Script Coding API SMS MASKING”
PHP
PHP Metode GET
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.tcastsms.net/api/v2/SendSMS?ApiKey=xxxx=&ClientId=xxxx&SenderId=xxxx&Message=xxxx&MobileNumbers=xxxx&Is_Unicode=false&Is_Flash=false', //our base api url and parameters CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', )); $response = curl_exec($curl); curl_close($curl); echo $response; ?>
PHP Metode POST
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.tcastsms.net/api/v2/SendSMS', //our base api url CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS =>'{ "SenderId":"xxxx", "Is_Unicode":false, "Is_Flash":false, "SchedTime":"", "GroupId":"", "Message":"xxxx", "MobileNumbers":"xxxx", "ServiceId":"", "CoRelator":"", "LinkId":"", "ApiKey":"xxxx", "ClientId":"xxxx" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; ?>
JAVA
JAVA Metode GET
package com.salespoint.api; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class SendSmsGet { public static void main(String[] args) { SendSmsGet smsObj = new SendSmsGet(); smsObj.sendSms(); } private void sendSms() { try { String urlString = "https://api.tcastsms.net/api/v2/SendSMS?ApiKey=xxxx=" + "&ClientId=xxxx&SenderId=xxxx&Message=xxxx" + "&MobileNumbers=xxxx&Is_Unicode=false&Is_Flash=false"; //our base api url and parameters URL urlNew = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) urlNew.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/json"); if (conn.getResponseCode() != 200) { throw new RuntimeException("Failed : HTTP Error code : " + conn.getResponseCode()); } InputStreamReader in = new InputStreamReader(conn.getInputStream()); BufferedReader br = new BufferedReader(in); String output; while ((output = br.readLine()) != null) { System.out.println(output); } conn.disconnect(); } catch (Exception e) { System.out.println("Exception in SendSmsGet:- " + e); } } }
JAVA Metode POST
package com.salespoint.api; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.LinkedHashMap; import java.util.Map; public class SendSmsPost { public static void main(String[] args) { SendSmsPost smsObj = new SendSmsPost(); smsObj.sendSms(); } private void sendSms() { try { URL url = new URL("https://api.tcastsms.net/api/v2/SendSMS"); //our base api url (required) Map<String,Object> params = new LinkedHashMap<>(); params.put("SenderId", "xxxx"); //your sender id approved by operator (required) params.put("Is_Unicode", false); params.put("Is_Flash", false); params.put("SchedTime", ""); params.put("GroupId", ""); params.put("MobileNumbers", "xxxx"); //destination number (required) params.put("ServiceId", ""); params.put("CoRelator", ""); params.put("LinkId", ""); params.put("ApiKey", "xxxx"); //your ApiKey (required) params.put("ClientId", "xxx"); //your ClientId (required) params.put("Message", "Test SMS Lagi"); StringBuilder postData = new StringBuilder(); for (Map.Entry<String,Object> param : params.entrySet()) { if (postData.length() != 0) postData.append('&'); postData.append(URLEncoder.encode(param.getKey(), "UTF-8")); postData.append('='); postData.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8")); } byte[] postDataBytes = postData.toString().getBytes("UTF-8"); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length)); conn.setDoOutput(true); conn.getOutputStream().write(postDataBytes); InputStreamReader in = new InputStreamReader(conn.getInputStream()); BufferedReader br = new BufferedReader(in); String output; while ((output = br.readLine()) != null) { System.out.println(output); } conn.disconnect(); } catch (Exception e) { System.out.println("Exception in SendSmsPost:- " + e); } } }
“Java Script”
JAVASCRIPT metode GET
var raw = ""; var requestOptions = { method: 'GET', body: raw, redirect: 'follow' }; fetch("https://api.tcastsms.net/api/v2/SendSMS?ApiKey=xxxx&ClientId=xxxx&SenderId=xxxx&Message=xxxx&MobileNumbers=xxxx&Is_Unicode=false&Is_Flash=false", requestOptions) //our base api url and parameters .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
JAVASCRIPT metode POST
var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); var raw = JSON.stringify({ "SenderId": "xxxx", //your sender id approved by operator (required) "Is_Unicode": false, "Is_Flash": false, "SchedTime": "", "GroupId": "", "Message": "xxxx", //your message (required) "MobileNumbers": "xxxx", //your destination number (required) "ServiceId": "", "CoRelator": "", "LinkId": "", "ApiKey": "", //your ApiKey (required) "ClientId": "" //your ClientId (required) }); var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("https://api.tcastsms.net/api/v2/SendSMS", requestOptions) //our base api url .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
NodeJS
NodeJS metode GET
var https = require('follow-redirects').https; var fs = require('fs'); var options = { 'method': 'GET', 'hostname': 'api.tcastsms.net', 'path': '/api/v2/SendSMS?ApiKey=xxxx&ClientId=xxxx&SenderId=xxxx&Message=xxxx&MobileNumbers=xxxx&Is_Unicode=false&Is_Flash=false', //our base api url and parameters 'headers': { }, 'maxRedirects': 20 }; var req = https.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function (chunk) { var body = Buffer.concat(chunks); console.log(body.toString()); }); res.on("error", function (error) { console.error(error); }); }); req.end();
NodeJS metode POST
var https = require('follow-redirects').https; var fs = require('fs'); var options = { 'method': 'POST', 'hostname': 'api.tcastsms.net', //our base api url 'path': '/api/v2/SendSMS', //our path api url 'headers': { 'Content-Type': 'application/json' }, 'maxRedirects': 20 }; var req = https.request(options, function (res) { var chunks = []; res.on("data", function (chunk) { chunks.push(chunk); }); res.on("end", function (chunk) { var body = Buffer.concat(chunks); console.log(body.toString()); }); res.on("error", function (error) { console.error(error); }); }); var postData = JSON.stringify({ "SenderId": "xxxx", //your sender id approved by operator (required) "Is_Unicode": false, "Is_Flash": false, "SchedTime": "", "GroupId": "", "Message": "xxxx", //your message (required) "MobileNumbers": "xxxx", //your destination number (required) "ServiceId": "", "CoRelator": "", "LinkId": "", "ApiKey": "xxxx", //your ApiKey (required) "ClientId": "xxxx" //your ClientId (required) }); req.write(postData); req.end();
Phyton
Phyton metode GET
import requests url = "https://api.tcastsms.net/api/v2/SendSMS?ApiKey=xxxx&ClientId=xxxx&SenderId=xxxx&Message=xxxx&MobileNumbers=xxxx&Is_Unicode=false&Is_Flash=false" #our base api url and parameters payload = "" headers = {} response = requests.request("GET", url, headers=headers, data=payload) print(response.text)
Phyton metode POST
import requests import json url = "https://api.tcastsms.net/api/v2/SendSMS" #our base api url payload = json.dumps({ "SenderId": "xxxx", #your sender id approved by operator (required) "Is_Unicode": False, "Is_Flash": False, "SchedTime": "", "GroupId": "", "Message": "xxxx", #your message (required) "MobileNumbers": "xxxx", #destination number (required) "ServiceId": "", "CoRelator": "", "LinkId": "", "ApiKey": "xxxx", #your ApiKey (required) "ClientId": "xxxx" #your ClientId (required) }) headers = { 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)
Ruby
Ruby metode GET
require "uri" require "net/http" url = URI("https://api.tcastsms.net/api/v2/SendSMS?ApiKey=xxxx&ClientId=xxxx&SenderId=xxxx&Message=xxxx&MobileNumbers=xxxx&Is_Unicode=false&Is_Flash=false") #our base api url and parameters https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Get.new(url) response = https.request(request) puts response.read_body
Ruby metode POST
require "uri" require "json" require "net/http" url = URI("https://api.tcastsms.net/api/v2/SendSMS") #our base api url https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request.body = JSON.dump({ "SenderId": "xxxx", #your sender id approved by operator (required) "Is_Unicode": false, "Is_Flash": false, "SchedTime": "", "GroupId": "", "Message": "xxxx", #your message (required) "MobileNumbers": "xxxx", #your destination number (required) "ServiceId": "", "CoRelator": "", "LinkId": "", "ApiKey": "xxxx", #your ApiKey "ClientId": "xxxx" #your ClientID }) response = https.request(request) puts response.read_body
DotNet
DotNet metode GET
var client = new RestClient("https://api.tcastsms.net/api/v2/SendSMS?ApiKey=xxxx&ClientId=xxxx&SenderId=xxxx&Message=xxxx&MobileNumbers=xxxx&Is_Unicode=false&Is_Flash=false"); //our base api url and parameters client.Timeout = -1; var request = new RestRequest(Method.GET); var body = @""; request.AddParameter("text/plain", body, ParameterType.RequestBody); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);
DotNet metode POST
var client = new RestClient("https://api.tcastsms.net/api/v2/SendSMS"); //our base api url client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Content-Type", "application/json"); //parameters var body = @"{ " + "\n" + @"""SenderId"":""xxxx"", " + "\n" + @"""Is_Unicode"":false, " + "\n" + @"""Is_Flash"":false, " + "\n" + @"""SchedTime"":"""", " + "\n" + @"""GroupId"":"""", " + "\n" + @"""Message"":""xxxx"", " + "\n" + @"""MobileNumbers"":""xxxx"", " + "\n" + @"""ServiceId"":"""", " + "\n" + @"""CoRelator"":"""", " + "\n" + @"""LinkId"":"""", " + "\n" + @"""ApiKey"":""xxxx"", " + "\n" + @"""ClientId"":""xxxx"" " + "\n" + @"}"; request.AddParameter("application/json", body, ParameterType.RequestBody); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);