SMSFlow resources
Sending SMS with Java using the SMSFlow HTTP API
Java applications can call SMSFlow’s HTTPS API with the standard Java HTTP client. This guide uses Java 11 or newer; it does not require or advertise a separate SMSFlow Java SDK.
Authenticate on the backend
Follow the authentication reference to obtain a login token using your Client ID and Client Secret. The published HTTP examples show the Basic authentication encoding. Keep credentials and tokens outside source code and frontend/mobile clients. Set the resulting token as SMSFLOW_LOGIN_TOKEN in your test environment.
Prepare send.json
{
"SendOptions": {
"startDeliveryUtc": null,
"campaignName": "Website synthetic example",
"checkOptOuts": true
},
"messages": [
{
"content": "Your demo appointment is confirmed for 10:00.",
"destination": "27000000000"
}
]
}
The destination is synthetic. Replace it only with an authorised test recipient. Save this body as send.json in the program’s working directory. Running a real send consumes credits.
Send with Java HttpClient
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.file.Files;
import java.nio.file.Path;
public class SendSmsExample {
public static void main(String[] args) throws Exception {
String token = System.getenv("SMSFLOW_LOGIN_TOKEN");
if (token == null || token.isBlank())
throw new IllegalArgumentException("Set SMSFLOW_LOGIN_TOKEN");
String body = Files.readString(Path.of("send.json"));
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://portal.smsflow.co.za/api/integration/BulkMessages"))
.header("Authorization", "Bearer " + token)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body)).build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println("HTTP " + response.statusCode());
// Inspect the response securely; do not blindly retry an uncertain send.
}
}
Save the source as SendSmsExample.java. Compile with javac SendSmsExample.java and run with java SendSmsExample only when you intend the controlled send. The website never executes it. Review the response securely using the sending reference.
Distinguish acceptance, delivery and an uncertain result
An HTTP success describes API acceptance, not a person reading an SMS. Authentication and validation errors need their cause corrected. A timeout may leave the sending outcome unknown, so do not blindly replay the batch. Use the error and retry guidance and retain non-sensitive correlation information for investigation.
Continue the integration
Use the balance reference, HTTP/Postman guide and SMS API overview. If your stack changes, the developer hub links the official .NET, Node.js and Python packages. Review message-segment costs before expanding beyond a small test.
Keep the Java integration predictable
This guide uses Java’s HTTP client. There is no separate SMSFlow Java SDK linked here. Store the login token on the backend, use the documented request shape and retain the send response for troubleshooting.
- Validate recipient and message inputs before building the request.
- Read HTTP and application error responses; do not equate request acceptance with delivery.
- Investigate uncertain sends before retrying, because repeating a request can send a duplicate SMS.
Use the API buying guide for supported capabilities, pricing for message-part costs and developer resources for other language options.