SMS delivery: What rate should you expect? How to optimize it. read the article SMS delivery: What rate should you expect? How to optimize it.more information Entrega de SMS: ¿Qué tasa debe esperar? How to optimize it. más información Consegna degli SMS: quale tasso di consegna si deve prevedere? How to optimize it.per saperne di più SMS-Zustellung: Welche Rate ist zu erwarten? Wie man sie optimiert.mehr erfahren

focus smsmode©

focus on
Java SMS

You have a Java development environment and you want to implement sending SMS to your recipient. With the HTTP API, many common SMS scenarios are within your reach, such as sending and receiving messages, authenticating by OTP code, or creating advanced controllers or scenarios at the base of sending and receiving texts to your contact base. .

Our SMS Java Startup guide will guide you to add this SMS-sending feature to your Java WEB application. Follow it, it will show you how fast it is to start sending an SMS!

I discover the API Documentation

SENDING JAVA SMS IN DETAIL
Integrating a free SMS gatewaySimple and quick API integration

Compatible with all programming languages with HTTP GET and POST requests, the complete and free documentation allows a simple, fast and turnkey integration.

Maximum security for automated SMS sentMaximum security

Hosted in France, in a level 4 data-center, our SMS APIs guarantee maximum security, thanks in particular to the HTTPS protocol.

High Availability dedicated InfrastructureContinuous service

Our dedicated, high-availability infrastructure is continuously monitored 24/7/365 with fail-safecapability.

Support Team at your disposalTechnical support at your disposal

Our dedicated team of developers is available to help you integrate our SMS APIs or answer your questions.

QUICK START GUIDE

Start sending an SMS with Java!

Examples of messages sent through a Java application

Developer, in order to create a gateway between your application and our SMS platform, we provide you with complete documentation that details all the features and queries available on our SMS API. This HTTP API allows you to integrate with your Java development the sending of SMS (by mass or unit), the notification of the reports of the received SMS, the reception of SMS, the personalization of the issuer, the management of unsubscribe/STOP, etc.

CONSULT THE API HTTP DOCUMENTATION

However, to guide you step by step in this Java implementation, this sample source code will allow you to deploy your first SMS.

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();
 }
}

Compatible with the most common programming languages (PHP, Java, ASP, C++, Ruby, WINDEV, Curl, etc.), this SMS gateway to our routing services is open source. The queries will allow you to configure the sending and receiving of SMS to one or more recipients and to manage your entire customer account (contact file, available credits, scheduling of the date and time of sending, Consultation of the status of reception, personalization of the issuer, etc.).

What you need to know about our Java SMS WebService!

Our SMS sending service offers you all the guarantees for your SMS marketing or notification campaigns. Accessible from our SMS API or a personal customer space in SaaS mode, our SMS gateway is ideal for directing email messages, mailings or professional push notifications to your contacts ' mobile phones.

It offers:

1Routing to MVMOs on the best routes
As a telecom operator, we only transit SMS via high quality roads (excluding any use of roaming). We guarantee that 87% of the SMS sent are received within one minute of sending (to the French telephone operators). You get maximum quality and deliverability.

2Real-time monitoring and supervision of our SMS service
Our SMS Gateway is monitored continuously through our Kibana monitoring system. It allows you to track the performance of SMS mailings according to the different channels used (notification, marketing or One Time Password). Detailed deliverability statistics are available as well as alerts for possible system slowdowns.

3A secure, high-availability infrastructure used by over 10,000 customers
More than 1 million requests for a shipment volume are processed daily by our SMS platform (i.e. more than 100 million SMS sent per year). In addition, HTTPS protocols and SSL certificates guarantee maximum security and confidentiality.

Java SMS Send Gateway

WebService & Gateway SMS

Our team advises you...

Our sales team and our technical support are at your disposal via email, phone or chat to answer all your questions about the implementation of the sending of SMS Java. As an SMS service provider for nearly 15 years, we have provided you with advice for the implementation and expertise in SMS mailings.

CONTACT US