Skip to main content

Send SMS Programming Examples

All examples use JSON requests. Pick your preferred language.

OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
String json = """
{
"method": "SendSms",
"userdata": {
"username": "api_username",
"password": "api_key"
},
"msgdata": [
{
"number": "256700111222",
"message": "Hello World!",
"senderid": "MyCompany",
"priority": "0"
},
{
"number": "256700333444",
"message": "Hello World 2!",
"senderid": "MyCompany",
"priority": "0"
}
]
}
""";
RequestBody body = RequestBody.create(mediaType, json);
Request request = new Request.Builder()
.url("https://comms.egosms.co/api/v1/json/")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();