INFO

Pour continuer à vous accompagner, à répondre à vos questions et à assurer le routage de SMS, smsmode© reste à votre disposition durant toute la durée du confinement.
Vous pouvez ainsi contacter l’ensemble de notre équipe aux numéros de téléphone et mail habituels, ainsi que par chat.

Plateforme de
messageries mobiles A2P

Intégrez les SMS, TTS, WhatsApp & RCS
à vos applications & votre communication

Spécialiste de l’envoi et la réception de SMS, TTS, WhatsApp et RCS, nos solutions de messageries mobiles performantes s’adaptent à tous vos besoins et tous vos volumes. Avec une couverture mondiale en connexion directe opérateurs, les solutions de notre plateforme CPaaS vous permettront de construire des applications via nos APIs et webservices puissants.

PLATEFORME DE MOBILE MESSAGING
DES SERVICES SIMPLES & PUISSANTS
ADAPTÉS À CHACUN DE VOS BESOINS

Développez votre business avec des outils performants et constamment améliorés par notre équipe. Ils sont conçus pour être intuitifs, faciles à utiliser pour réaliser vos campagnes vers des milliers de contacts en quelques clics seulement !

 

  • plateforme SaaS en libre-service
  • fonctionnalités complètes pour l’envoi, la gestion, l’analyse ou les exports des campagnes
  • statistiques de réception fournies et gestion automatique des désabonnements

CRÉEZ VOTRE COMPTE GRATUIT

plateforme d'envoi de SMS

INTEGRATION
IMPLÉMENTEZ RAPIDEMENT NOTRE API SMS
À L’AIDE DE NOS SDK

Intégrez toutes les fonctionnalités d’envoi, de réception et d’authentification par SMS en haute qualité dans votre
application, votre site ou logiciel, en quelques minutes. En utilIsant notre API Rest, vous réalisez des notifications par SMS rapidement, de manière fiable, sécurisée et partout dans le monde.

 

  • compatible avec tous les langages de programmation (PHP, Java, ASP, C++, Ruby, WINDEV, etc.)
  • full SDK et librairies disponibles avec des snippets des requêtes disponibles
  • forte expérience dans l’accompagnement de startups
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;
         }
     }
 }
}
ResLancement = HTTPRequête("https://api.smsmode.com")
SI ResLancement = Vrai ALORS
 ResCode = HTTPDonneRésultat()
 Info("Code HTML : " + ResCode)
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;
 }
};

AVANTAGES & GARANTIES DE SERVICE
TESTEZ LA DIFFÉRENCE SMSMODE© !

4millions de requêtes
API traitées par jour

envoi de SMS connexion direct opérateursUn routage en direct opérateurs
en notre qualité d’Opérateur Télécom ARCEP

10000clients accompagnés
depuis 2004

Confidentialité des donnéesUne confidentialité
de vos envois

garantie par un chiffrement
de vos données

Proximité de nos services d'envoi de SMSUn service de proximité
avec des interlocuteurs et
des solutions techniques
exclusivement basés à Marseille

support 24/7Un support 24/7
incluant un système
de gestion de tickets
réactif

Membre de la French TechPlateforme CPaaS
française

membre de la French Tech, de la MMAF et de la GSMA

Besoin de plus d’infos ?
N’hésitez pas à nous contacter.