SMS API
Designed for developers. Built for performance.
Implement our API to send SMS MT & receive SMS MO to International. Our SDKs facilitates the development of custom SMS sending and receiving capabilities. Our webservices are compatible with the language of your choice (PHP, Java, CURL, .net, JSON, C#, XML, Python, RUBY, ASP, C++,...).
SEE THE DOCUMENTATION OF OUR API (PDF - EN)
SEE THE TECHNICAL DOCUMENTATION (PDF - EN)
CONSULT THE DEVELOPER'S DOCUMENTATION (PDF - EN) CONSULTARE LA DOCUMENTAZIONE DELLO SVILUPPATORE (PDF - EN) BERATEN SIE DIE ENTWICKLERDOKUMENTATION (PDF - EN)
GETTING STARTED GUIDE
IMPLEMENT YOUR FIRST REQUEST...
const ERROR_API = "Error during API call\n"; const ERROR_FILE = "The specified file does not exist\n"; const URL = "https://api.smsmode.com/http/1.6/"; const PATH_SEND_SMS = "sendSMS.do"; const PATH_SEND_SMS_BATCH = "sendSMSBatch.do"; /** *    Function parameters: * *    - accessToken (required) *    - message (required) *    - destinataires (required): Receivers separated by a comma *    - emetteur (optional): Allows to deal with the sms sender *    - optionStop (optional): Deal with the STOP sms when marketing send (cf. API HTTP documentation) *    - batchFilePath (required for batch mode): The path of CSV file for sms in Batch Mode */ class ExempleClientHttpApi { // send SMS with GET method public function sendSmsGet($accessToken, $message, $destinataires, $emetteur, $optionStop) {     $message = iconv("UTF-8", "ISO-8859-15", $message);     $fields_string = '?accessToken='.$accessToken.'&message='.urlencode($message).'&numero='.$destinataires.'&emetteur='.$emetteur.'&stop='.$optionStop;     $ch = curl_init();     curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);     curl_setopt($ch,CURLOPT_URL, URL.PATH_SEND_SMS.$fields_string);     $result = curl_exec($ch);     curl_close($ch);     if (!$result) {         return ERROR_API;     }     return $result; } // send SMS with POST method public function sendSmsPost($accessToken, $message, $destinataires, $emetteur, $optionStop) {     $message = iconv("UTF-8", "ISO-8859-15", $message);     $fields_string = 'accessToken='.$accessToken.'&message='.urlencode($message).'&numero='.$destinataires.'&emetteur='.$emetteur.'&stop='.$optionStop;     $ch = curl_init();     curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);     curl_setopt($ch,CURLOPT_URL, URL.PATH_SEND_SMS);     curl_setopt($ch,CURLOPT_POST, 1);     curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);     $result = curl_exec($ch);     curl_close($ch);     if (!$result) {         return ERROR_API;     }     return $result; } // send SMS with POST method (Batch) public function sendSmsBatch($accessToken, $batchFilePath, $optionStop) {     if (!file_exists($batchFilePath)) {         return ERROR_FILE;     }     $fields_string = '?accessToken='.$accessToken.'&stop='.$optionStop;     $cfile = new CurlFile($batchFilePath, 'text/csv');     $data = array('data-binary' => $cfile);     $ch = curl_init();     curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);     curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'content-type: multipart/form-data'));     curl_setopt($ch,CURLOPT_URL, URL.PATH_SEND_SMS_BATCH.$fields_string);     curl_setopt($ch,CURLOPT_POST, 1);     curl_setopt($ch,CURLOPT_POSTFIELDS, $data);     $result = curl_exec($ch);     curl_close($ch);     if (!$result) {         return ERROR_API;     }     return $result; } }
const urlencode = require('urlencode'); var exports=module.exports={}; const urlencode = require('urlencode'); const http = require('https'); const querystring = require('querystring'); const fs = require('fs'); const pathname = require("path"); const ERROR_API = "Error during API call"; const ERROR_FILE = "The specified file does not exist"; const HOSTNAME = 'api.smsmode.com' const PATH_SEND_SMS = "/http/1.6/sendSMS.do"; const PATH_SEND_SMS_Batch = "/http/1.6/sendSMSBatch.do"; /** *    Function parameters: * *    - accessToken (required) *    - message (required) *    - destinataires (required): Receivers separated by a comma *    - emetteur (optional): Allows to deal with the sms sender *    - optionStop (optional): Deal with the STOP sms when marketing send (cf. API HTTP documentation) *    - batchFilePath (required for batch mode): The path of CSV file for sms in Batch Mode */ exports.ExempleClientHttpAPI = class { // send SMS with GET method async sendSmsGet(accessToken, message, destinataires, emetteur, optionStop) {     var finalPath = PATH_SEND_SMS + '?accessToken=' + accessToken + '&numero=' + destinataires +         "&message=" + urlencode(message,'ISO-8859-15') + '&emetteur=' + emetteur + '&stop=' + optionStop;     const options = {         hostname: HOSTNAME,         port: 443,         path: finalPath,         method: 'GET'     };     try {         let http_promise = this.getHttpResponse(options, "");         let response_body = await http_promise;         return response_body;     }     catch(error) {         return ERROR_API;     } } // send SMS with POST method async sendSmsPost(accessToken, message, destinataires, emetteur, optionStop) {     var postData = querystring.stringify({         'accessToken': accessToken,         'numero': destinataires,         'emetteur' : emetteur,         'stop' : optionStop     });     postData = postData + "&message=" + urlencode(message,'ISO-8859-15');     const options = {         hostname: HOSTNAME,         port: 443,         path: PATH_SEND_SMS,         method: 'POST',         headers: {             'Content-Type': 'application/x-www-form-urlencoded; charset=ISO-8859-15',             'Content-Length': Buffer.byteLength(postData)         }     };     try {         let http_promise = this.getHttpResponse(options, postData);         let response_body = await http_promise;         return response_body;     }     catch(error) {         return ERROR_API;     } } // send SMS with POST method (Batch) async sendSmsBatch(accessToken, batchFilePath, optionStop) {     var finalPath = PATH_SEND_SMS_Batch + "?accessToken=" + accessToken + "&stop=" + optionStop;     try {         let content_file_promise = this.getContentFile(batchFilePath);         let content = await content_file_promise;         var boundary = "AaB03x";         var postData = Buffer.concat([             Buffer.from("--" + boundary + "\r\n"),             Buffer.from("Content-Disposition: form-data; name=\"file\"; filename=\""),             Buffer.from(pathname.basename(batchFilePath) + "\"\r\n"),             Buffer.from("Content-Type:text/csv\r\n\r\n"),             Buffer.from(content),             Buffer.from("\r\n--" + boundary + "--\r\n"),         ]);         var options = {             method: 'POST',             hostname: HOSTNAME,             port: 443,             path: finalPath,             headers: {                 "Content-Type": "multipart/form-data; boundary=" + boundary,                 'Content-Length': Buffer.byteLength(postData)             }         };         try {         let http_promise = this.getHttpResponse(options, postData);         let response_body = await http_promise;         return response_body;         }         catch(error) {             return ERROR_API;         }     }     catch(error) {         return ERROR_FILE;     } } getHttpResponse(options, postData) {     return new Promise((resolve, reject) => {         const req = http.request(options, (res) => {             let chunks_of_data = [];             res.on('data', (fragments) => {                 chunks_of_data.push(fragments);             });             res.on('end', () => {                 let response_body = Buffer.concat(chunks_of_data);                 resolve(response_body.toString());             });         });         req.on('error', (error) => {             reject(error);         });         req.write(postData);         req.end();     }); } getContentFile(batchFilePath) {     return new Promise((resolve, reject) => {         fs.readFile(batchFilePath, async function(err, content) {             if (err) {                 reject(err);             } else {                 resolve(content);             }         });     }); } }
import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.multipart.FilePart; import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity; import org.apache.commons.httpclient.methods.multipart.Part; import org.apache.commons.httpclient.util.EncodingUtil; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Scanner; /** *    Parameters: * *    - accessToken (required) *    - message (required) *    - destinataires (required): Receivers separated by a comma *    - emetteur (optional): Allows to deal with the sms sender *    - optionStop (optional): Deal with the STOP sms when marketing send (cf. API HTTP documentation) *    - batchFilePath (required for batch mode): The path of CSV file for sms in Batch Mode */ public class ExempleClientHttpAPI { private static final String URL = "https://api.smsmode.com/http/1.6/"; private static final String PATH_SEND_SMS = "sendSMS.do"; private static final String PATH_SEND_SMS_BATCH = "sendSMSBatch.do"; private static final String ERROR_FILE = "The specified file does not exist"; // send SMS with GET method public String sendSmsGet(String accessToken, String message, String destinataires, String emetteur, String optionStop) throws IOException {     HttpClient httpClient = new HttpClient();     String finalUrl = URL + PATH_SEND_SMS;     GetMethod httpMethod = new GetMethod(finalUrl);     httpMethod.addRequestHeader("Content-Type", "plain/text; charset=ISO-8859-15");     NameValuePair[] params = {         new NameValuePair("accessToken", accessToken),         new NameValuePair("message", message),         new NameValuePair("numero", destinataires),         new NameValuePair("emetteur", emetteur),         new NameValuePair("stop", optionStop)     };     httpMethod.setQueryString(EncodingUtil.formUrlEncode(params, "ISO-8859-15"));     httpClient.executeMethod(httpMethod);     return convertToString(httpMethod.getResponseBodyAsStream()); } // send SMS with POST method public String sendSmsPost(String accessToken, String message, String destinataires, String emetteur, String optionStop) throws IOException {     HttpClient httpClient = new HttpClient();     String finalUrl = URL + PATH_SEND_SMS;     PostMethod httpMethod = new PostMethod(finalUrl);     httpMethod.addRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=ISO-8859-15");     NameValuePair[] params = {         new NameValuePair("accessToken", accessToken),         new NameValuePair("message", message),         new NameValuePair("numero", destinataires),         new NameValuePair("emetteur", emetteur),         new NameValuePair("stop", optionStop)     };     httpMethod.setRequestBody(params);     httpClient.executeMethod(httpMethod);     return convertToString(httpMethod.getResponseBodyAsStream()); } // send SMS with POST method (Batch) public String sendSmsBatch(String accessToken, String batchFilePath, String optionStop) throws IOException {     File file = new File(batchFilePath);     if (!file.exists())         return ERROR_FILE;     HttpClient httpClient = new HttpClient();     String finalUrl = URL + PATH_SEND_SMS_BATCH + "?accessToken=" + accessToken + "&stop=" + optionStop;     PostMethod httpMethod = new PostMethod(finalUrl);     Part[] parts = new Part[1];     parts[0] = new FilePart(file.getName(), file, "text/csv", null);     httpMethod.setRequestEntity(new MultipartRequestEntity(parts, httpMethod.getParams()));     httpClient.executeMethod(httpMethod);     return convertToString(httpMethod.getResponseBodyAsStream()); } private String convertToString(InputStream stream) {     Scanner sc = new Scanner(stream);     StringBuilder sb = new StringBuilder();     while(sc.hasNext()){         sb.append(sc.nextLine());     }     return sb.toString(); } }
import requests import urllib import sys import os.path ERROR_API = "Error during API call" ERROR_FILE = "The specified file does not exist" URL = 'https://api.smsmode.com/http/1.6/' PATH_SEND_SMS = "sendSMS.do" PATH_SEND_SMS_BATCH = "sendSMSBatch.do" """ *    Function parameters: * *    - access_token (required) *    - message (required) *    - destinataires (required): Receivers separated by a comma *    - emetteur (optional): Allows to deal with the sms sender *    - option_stop (optional): Deal with the STOP sms when marketing send (cf. API HTTP documentation) *    - batch_file_path (required for batch mode): The path of CSV file for sms in Batch Mode """ class ExempleClientHttpApi: # send SMS with GET method def send_sms_get(self, access_token, message, destinataires, emetteur, option_stop):     final_url = (         URL + PATH_SEND_SMS +         '?accessToken=' + access_token +         '&message=' + urllib.quote_plus(message.encode('iso-8859-15')) +         '&numero=' + destinataires +         '&emetteur=' + emetteur +         '&stop=' + option_stop     )     r = requests.get(final_url)     if not r:         return ERROR_API     return r.text # send SMS with POST method def send_sms_post(self, access_token, message, destinataires, emetteur, option_stop):     final_url = URL + PATH_SEND_SMS     headers = {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}     payload = {         'accessToken': access_token,         'message': message,         'numero': destinataires,         'emetteur': emetteur,         'stop': option_stop     }     r = requests.post(final_url, data=payload, headers=headers)     if not r:         return ERROR_API     return r.text # send SMS with POST method (Batch) def send_sms_batch(self, access_token, batch_file_path, option_stop):     final_url = URL + PATH_SEND_SMS_BATCH + "?accessToken=" + access_token + "&stop=" + option_stop     if not os.path.isfile(batch_file_path):         return ERROR_FILE     r = requests.post(final_url, files={'file': open(batch_file_path,'rb')})     if not r:         return ERROR_API     return r.text
using System; using System.IO; using System.Net.Http; using System.Net.Http.Headers; using System.Threading.Tasks; using System.Text; using System.Web; /** *    Function parameters: * *    - accessToken (required) *    - message (required) *    - destinataires (required): Receivers separated by a comma *    - emetteur (optional): Allows to deal with the sms sender *    - optionStop (optional): Deal with the STOP sms when marketing send (cf. API HTTP documentation) *    - batchFilePath (required for batch mode): The path of CSV file for sms in Batch Mode */ namespace ExempleClientHttpApi { public class ExempleClientHttpApi {     private static string URL = "https://api.smsmode.com/http/1.6/";     private static string PATH_SEND_SMS = "sendSMS.do";     private static string PATH_SEND_SMS_BATCH = "sendSMSBatch.do";     private static string ERROR_API = "Error during API call\n";     private static string ERROR_FILE = "The specified file does not exist\n";     private static readonly HttpClient _httpClient= new HttpClient();     public ExempleClientHttpApi()     {         Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);     }     // send SMS with GET method     public string sendSmsGet(string accessToken, string message, string destinataires, string emetteur, string optionStop) {         string urlEncodedMessage = HttpUtility.UrlEncode(message, Encoding.GetEncoding("ISO-8859-15"));         string finalUrl = URL + PATH_SEND_SMS + "?accessToken=" + accessToken + "&numero=" + destinataires + "&message=" + urlEncodedMessage + "&emetteur=" + emetteur + "&stop=" + optionStop;         return Get(finalUrl).Result;     }     public static async Task<string> Get(string url){         try {             var response = await _httpClient.GetAsync(url);             string result = await response.Content.ReadAsStringAsync();             return result;         } catch (Exception) {             return ERROR_API;         }     }     // send SMS with POST method     public string sendSmsPost(string accessToken, string message, string destinataires, string emetteur, string optionStop) {         string finalUrl = URL + PATH_SEND_SMS;         StringBuilder sb = new StringBuilder();         sb.Append("accessToken=" + accessToken);         sb.Append("&numero=" + destinataires);         sb.Append("&emetteur=" + emetteur);         sb.Append("&message=" + HttpUtility.UrlEncode(message, Encoding.GetEncoding("ISO-8859-15")));         sb.Append("&stop=" + optionStop);         return Post(finalUrl ,Encoding.Default.GetBytes(sb.ToString())).Result;     }     public static async Task<string> Post(string url, byte[] data){         ByteArrayContent byteContent = new ByteArrayContent(data);         byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");         try {             var response = await _httpClient.PostAsync(url, byteContent);             string result = await response.Content.ReadAsStringAsync();             return result;         } catch (Exception) {             return ERROR_API;         }     }     // send SMS with POST method (batch)     public string sendSmsBatch(string accessToken, string batchFilePath, string optionStop) {         if (!File.Exists(batchFilePath)) {             return ERROR_FILE;         }         string finalUrl = URL + PATH_SEND_SMS_BATCH + "?accessToken=" + accessToken + "&stop=" + optionStop;         return PostBatch(finalUrl , File.ReadAllBytes(batchFilePath), batchFilePath).Result;     }     public static async Task<string> PostBatch(string url, byte[] data, string batchFilePath) {         var requestContent = new MultipartFormDataContent();         ByteArrayContent byteContent = new ByteArrayContent(data);         byteContent.Headers.ContentType = MediaTypeHeaderValue.Parse("text/csv");         requestContent.Add(byteContent, "file", batchFilePath);         try {             var response = await _httpClient.PostAsync(url, requestContent);             string result = await response.Content.ReadAsStringAsync();             return result;         } catch (Exception) {             return ERROR_API;         }     } } }
/** *    Function parameters: * *    - accessToken (required) *    - message (required) *    - recipients (required): Receivers separated by a comma *    - transmitter (optional): Allows to deal with the sms sender *    - optionStop (optional): Deal with the STOP sms when marketing send (cf. API HTTP documentation) *    - batchFilePath (required for batch mode): The path of CSV file for sms in Batch Mode */ ExampleClientHttpApi is a Class URL is a string = "https://api.smsmode.com/http/1.6/" PATH_SEND_SMS is a string = "sendSMS.do". PATH_SEND_SMS_BATCH is a string = "sendSMSBatch.do" FIN PROCEDURE Builder() PROCEDURE Destructor() PROCEDURE sendSmsGet(accessToken is a string, message is a string, recipients is a string, sender is a string, optionStop is a string) getField is a chain getField = "?accessToken=" + accessToken + "&message=" + message + "&number=" + recipients + "&sender=" + transmitter + "&stop=" + optionStop IF HTTQuery(URL + PATH_SEND_SMS + getField) = True THEN REFER HTMLVersTexte(HTTPDataResult(httpResult)) SINON REFER ErrorInfo() FIN PROCEDURE sendSmsPost(accessToken is a string, message is a string, recipient is a string, sender is a string, optionStop is a string) postField is a channel postField = "accessToken=" + accessToken + "&message=" + message + "&number=" + recipients + "&sender=" + transmitter + "&stop=" + optionStop IF HTTQuery(URL + PATH_SEND_SMS, "", "", postField) = True THEN REFER HTMLVersTexte(HTTPDataResult(httpResult)) SINON REFER (ErrorInfo()) FIN PROCEDURE sendSmsBatch(accessToken is a string, batchFilePath is a string, optionStop is a string) fdFile is an integer fdFile = fOuvre(batchFilePath) IF fdFile = -1 THEN REFER ("The specified file does not exist") FIN contentFile is a channel contentFile = fLit(fdFile,fSize(batchFilePath)) fFarm(fdFile) header is a string = "multipart/form-data; boundary=" + boundary postField is a channel postField = "--" + boundary + RC + Content-Disposition: form-data; name=""datafile""; filename=" + batchFilePath + """ + RC + RC + RC + contentFile + RC + "--" + boundary + "--" IF HTTQuery(URL + PATH_SEND_SMS_BATCH + "?accessToken=" + accessToken +"&stop=" + optionStop, "", "", postField, header) = True THEN REFER HTMLVersTexte(HTTPDataResult(httpResult)) SINON REFER (ErrorInfo()) FIN
require 'net/http' require 'uri' require 'json' #    Function parameters: # #    - accessToken (required) #    - message (required) #    - destinataires (required): Receivers separated by a comma #    - emetteur (optional): Allows to deal with the sms sender #    - optionStop (optional): Deal with the STOP sms when marketing send (cf. API HTTP documentation) #    - batchFilePath (required for batch mode): The path of CSV file for sms in Batch Mode class ExempleClientHttpApi ERROR_FILE = "The specified file does not exist"; URL = "https://api.smsmode.com/http/1.6/" PATH_SEND_SMS = "sendSMS.do" PATH_SEND_SMS_BATCH = "sendSMSBatch.do" def send_sms_get(access_token, message, destinataires, emetteur, option_stop)     header = {'Content-Type' => 'plain/text; charset=ISO-8859-15'}     params = { :accessToken => access_token, :message => message.encode(Encoding::ISO_8859_15), :numero => destinataires, :emetteur => emetteur, :stop => option_stop}     uri = URI.parse(URL + PATH_SEND_SMS);     uri.query = URI.encode_www_form(params)     http = Net::HTTP.new(uri.host,uri.port)     http.use_ssl = true     request = Net::HTTP::Get.new(uri.request_uri,header)     res = http.request(request)     return res.body end # send SMS with POST method def send_sms_post(access_token, message, destinataires, emetteur, option_stop)     header = {'Content-Type' => 'application/x-www-form-urlencoded; charset=ISO-8859-15'}     params = { :accessToken => access_token, :message => message.encode(Encoding::ISO_8859_15), :numero => destinataires, :emetteur => emetteur, :stop => option_stop}     uri = URI.parse(URL + PATH_SEND_SMS);     http = Net::HTTP.new(uri.host,uri.port)     http.use_ssl = true     request = Net::HTTP::Post.new(uri.request_uri,header)     request.body = URI.encode_www_form(params)     res = http.request(request)     return res.body end # send SMS with POST method (Batch) def send_sms_batch(access_token, batch_file_path, option_stop)     if !File.file?(batch_file_path)         return ERROR_FILE     end     boundary = "AaB03x"     header = {'Content-Type' => "multipart/form-data, boundary=#{boundary}"}     uri = URI.parse(URL + PATH_SEND_SMS_BATCH + '?accessToken=' + access_token + "&stop=" + option_stop);     post_body = []     post_body << "--#{boundary}\r\n"     post_body << "Content-Disposition: form-data; name=\"datafile\"; filename=\"#{File.basename(batch_file_path)}\"\r\n"     post_body << "\r\n"     post_body << File.read(batch_file_path)     post_body << "\r\n--#{boundary}--\r\n"     http = Net::HTTP.new(uri.host,uri.port)     http.use_ssl = true     request = Net::HTTP::Post.new(uri.request_uri, header)     request.body = post_body.join     res = http.request(request)     return res.body end end
import scalaj.http._ import java.nio.file.{Files, Paths} /** *    Function parameters: * *    - accessToken (required) *    - message (required) *    - destinataires (required): Receivers separated by a comma *    - emetteur (optional): Allows to deal with the sms sender *    - optionStop (optional): Deal with the STOP sms when marketing send (cf. API HTTP documentation) *    - batchFilePath (required for batch mode): The path of CSV file for sms in Batch Mode */ object ExempleClientHttpApi { var ERROR_FILE = "The specified file does not exist"; var URL = "https://api.smsmode.com/http/1.6/"; var PATH_SEND_SMS = "sendSMS.do"; var PATH_SEND_SMS_BATCH = "sendSMSBatch.do"; // send SMS with GET method def send_sms_get(accessToken:String, message:String, destinataires:String, emetteur:String, optionStop:String) : String = {     var SendSMSUsingGET = Http(URL + PATH_SEND_SMS)     .param("accessToken", accessToken)     .param("message", message)     .param("numero", destinataires)     .param("emetteur", emetteur)     .param("stop", optionStop)     .charset("ISO-8859-15")     .asString.body     return SendSMSUsingGET; } // send SMS with POST method def send_sms_post(accessToken:String, message:String, destinataires:String, emetteur:String, optionStop:String) : String = {     var SendSMSUsingPOST = Http(URL + PATH_SEND_SMS)     .postForm(         Seq(             "accessToken" -> accessToken,             "message" -> message,             "numero" -> destinataires,             "emetteur" -> emetteur,             "stop" -> optionStop         )     )     .charset("ISO-8859-15")     .asString.body     return SendSMSUsingPOST; } // send SMS with POST method (Batch) def send_sms_batch(accessToken:String, batchFilePath:String, optionStop:String) : String = {     if (!Files.exists(Paths.get(batchFilePath))) {         return ERROR_FILE;     }     var finalUrl : String = URL + PATH_SEND_SMS_BATCH + "?accessToken=" + accessToken + "&stop=" + optionStop;     var SendSMSUsingPOSTBatch = Http(finalUrl)     .postMulti(MultiPart("file", Paths.get(batchFilePath).getFileName().toString(), "text/csv", Files.readAllBytes(Paths.get(batchFilePath))))     .asString.body     return SendSMSUsingPOSTBatch; } }
#include <iostream> #include <curl/curl.h> #include <string.h> #include <sys/stat.h> #include <unistd.h> /** *    Function parameters: * *    - accessToken (required) *    - message (required) *    - destinataires (required): Receivers separated by a comma *    - emetteur (optional): Allows to deal with the sms sender *    - optionStop (optional): Deal with the STOP sms when marketing send (cf. API HTTP documentation) *    - batchFilePath (required for batch mode): The path of CSV file for sms in Batch Mode */ #define URL "https://api.smsmode.com/http/1.6/"; #define PATH_SEND_SMS "sendSMS.do"; #define PATH_SEND_SMS_BATCH "sendSMSBatch.do"; #define ERROR_API "Error during API call"; #define ERROR_FILE "The specified file does not exist"; using namespace std; static size_t WriteCallback(char *contents, size_t size, size_t nmemb, void *userp) { ((string*)userp)->append((char*)contents, size * nmemb); return size * nmemb; } class ExempleClientHttpAPI { public: // send SMS with GET method string sendSmsGet(string accessToken, string message, string destinataires, string emetteur, string optionStop) {     string finalUrl = URL;     finalUrl += PATH_SEND_SMS;     finalUrl += "?accessToken=" + accessToken +     "&message=" + curl_escape(message.c_str(), message.length()) +     "&numero=" + destinataires +     "&emetteur=" + emetteur +     "&stop=" + optionStop;     string readBuffer;     CURL *curl;     CURLcode res;     curl = curl_easy_init();     if(curl) {         curl_easy_setopt(curl, CURLOPT_URL, finalUrl.c_str());         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);         curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);         res = curl_easy_perform(curl);         if(res != CURLE_OK)         {             fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));             return ERROR_API;         }         curl_easy_cleanup(curl);     }     return readBuffer; } // send SMS with POST method string sendSmsPost(string accessToken, string message, string destinataires, string emetteur, string optionStop) {     string finalUrl = URL;     finalUrl += PATH_SEND_SMS;     string postField = "accessToken=" + accessToken + "&message=" + message +         "&numero=" + destinataires + "&emetteur=" + emetteur + "&stop=" + optionStop;     string readBuffer;     CURL *curl;     CURLcode res;     curl = curl_easy_init();     if(curl) {         curl_easy_setopt(curl, CURLOPT_URL, finalUrl.c_str());         curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postField.c_str());         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);         curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);         res = curl_easy_perform(curl);         if(res != CURLE_OK)         {             fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));             return ERROR_API;         }         curl_easy_cleanup(curl);     }     return readBuffer; } // send SMS with POST method (Batch) string sendSmsBatch(string accessToken, string batchFilePath, string optionStop) {     if(access(batchFilePath.c_str(), F_OK) == -1)         return ERROR_FILE;     string finalUrl = URL;     finalUrl += PATH_SEND_SMS_BATCH;     finalUrl += "?accessToken=" + accessToken +         "&stop=" + optionStop;     struct curl_httppost *formpost=NULL;     struct curl_httppost *lastptr=NULL;     string readBuffer;     CURL *curl;     CURLcode res;     curl = curl_easy_init();     if(curl) {         curl_formadd(&formpost,             &lastptr,             CURLFORM_COPYNAME, "sendfile",             CURLFORM_FILE, batchFilePath.c_str(),             CURLFORM_END);         curl_formadd(&formpost,             &lastptr,             CURLFORM_COPYNAME, "filename",             CURLFORM_COPYCONTENTS, batchFilePath.c_str(),             CURLFORM_END);         curl_easy_setopt(curl, CURLOPT_URL, finalUrl.c_str());         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);         curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);         curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);         res = curl_easy_perform(curl);         if(res != CURLE_OK)         {             fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));             return ERROR_API;         }     }     curl_easy_cleanup(curl);     return readBuffer; } };
API REFERENCES
THE RESOURCES NEEDED
FOR THE IMPLEMENTATION OF THE SMS API
API KEY
DEVELOPER DOCUMENTATION
GITHUB PHP LIBRARY
(version 2.8.1 certified by smsmode© - later versions are not verified)
PRODUCT DATA SHEET
CHARACTERISTICS OF THE API SMS
FEATURES INCLUDED
The API, based on a robust gateway, allows you to monitor SMS communications directly in your applications. Find out more about the features of our API.
- quick and easy integration of automated MT SMS and MO SMS responses into systems and applications
- compatibility with the most common programming languages (PHP, Java, ASP, C++, Ruby, WINDEV, cURL, .NET, JSON, C#, XML, Python, etc.) for use with all applications and software solutions
- a robust, high-availability infrastructure handling more than 4 million requests daily
- simple HTTP requests allowing the integration of extended functionalities for the automated sending of SMS (immediate or scheduled sending of SMS, deletion of SMS, history of SMS, retrieval of reception reports or DLR, addition of contact, automatic notification, personalisation of senders or sender ID, etc.)
- management of sending priorities with a separation of SMS marketing, SMS notification and One Time Password traffic on different channels to optimise the deliverability of critical messages
- the ability to send Pro SMS, TTS Voice SMS, OTP SMS or Unicode SMS (with emoticons or characters from non-Latin languages - Cyrillic, Greek, Arabic, Hebrew, Chinese, Japanese, etc.)
- routing of text messages in maximum quality on all operators in France and in more than 166 countries (including French overseas departments and territories)
- management of responses and DLRs (reports) with real-time notification
RATES
API SMS TARIFFS
CHOOSE THE DESTINATION OF THE SMS SENT
SELECT CURRENCY
Prices in $US, £ and $CA are approximate and based on the application of an exchange rate to the price in Euro.
SETTING UP COSTS
- Unlimited period of validity of SMS packs
OUR BENEFITS
WHY IMPLEMENT THE SMS SMSMODE© API ?
EASY INTEGRATION AND SCALABLE STRUCTURE
Our ready-to-use API is designed for scalability and performance. With a few API calls documented by complete SDKs, you integrate SMS send and receive functionalities, manage authentication settings, response formats, and more.
AN API WITH A SERVICE LEVEL (SLA) OF 99.999%.
Our dedicated and high availability infrastructure is continuously monitored, 24/7, with resistance to failure thanks to a solution for switching traffic to backup providers. The success rate of the API SMS is thus the real indicator of our expertise.
FRENCH CUSTOMER SUPPORT AVAILABLE 24/7
Our experts accompany you in the implementation and follow-up of the SMS messages made with our webservice. They have powerful tools to monitor your traffic (ElasticSearch, Logstash, Kibana – ELK –).
Need more info?
Do not hesitate to contact us.