Introduction
The Expected Request:
{
"username" : "yousef",
"password" : "Y0u$ef",
"sendername" : "Ibrahim",
"mobiles" : "201111111111",
"message" : "There Is A Great Offer For You"
}
Welcome to the SMS Smart Egypt API! You can use our API to access Our SMS System endpoints, which can Send SMS From It To Your Customers.
We have language bindings in Shell, Ruby, Python, and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
SMS API
To Send SMS With API with Code:
require "uri"
require "net/http"
url = URI("https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Accept-Language"] = "en-US"
response = https.request(request)
puts response.read_body
import http.client
conn = http.client.HTTPSConnection("smssmartegypt.com")
payload = ''
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Accept-Language': 'en-US'
}
conn.request("POST", "/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
#Python requests
import requests
url = "https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?"
payload={}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Accept-Language': 'en-US'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Accept-Language", "en-US");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
//JavaScript JQurey
var settings = {
"url": "https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Accept": "application/json",
"Accept-Language": "en-US"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
//Nodejs
var unirest = require('unirest');
var req = unirest('POST', 'https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?')
.headers({
'Content-Type': 'application/json',
'Accept': 'application/json',
'Accept-Language': 'en-US'
})
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
//NodeJS HTTP
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'smssmartegypt.com',
'path': '/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Accept-Language': 'en-US'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
//NodeJS Request
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Accept-Language': 'en-US'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
//NodeJS axios
var axios = require('axios');
var config = {
method: 'post',
url: 'https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Accept-Language': 'en-US'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("application/json", forHTTPHeaderField: "Accept")
request.addValue("en-US", forHTTPHeaderField: "Accept-Language")
request.httpMethod = "POST"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
#import <Foundation/Foundation.h>
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Type": @"application/json",
@"Accept": @"application/json",
@"Accept-Language": @"en-US"
};
[request setAllHTTPHeaderFields:headers];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
dispatch_semaphore_signal(sema);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSError *parseError = nil;
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
NSLog(@"%@",responseDictionary);
dispatch_semaphore_signal(sema);
}
}];
[dataTask resume];
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
<?php
#PHP Laravel 8/Laravel 7
use Illuminate\Support\Facades\Http;
$response = Http::post('https://smssmartegypt.com/sms/api/', [
'username' => 'yousef',
'password' => 'Y0u$ef',
'sendername' => 'Ibrahim',
'mobiles' => '201111111111',
'message' => 'There Is A Great Offer For You',
]);
#PHP Pure
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Accept-Language: en-US'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
#Php Request2
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Accept-Language' => 'en-US'
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
#php pecl_http
<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?');
$request->setRequestMethod('POST');
$request->setOptions(array());
$request->setHeaders(array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Accept-Language' => 'en-US'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("Accept", "application/json")
$headers.Add("Accept-Language", "en-US")
$response = Invoke-RestMethod 'https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?' -Method 'POST' -Headers $headers
$response | ConvertTo-Json
//Java OkHttp
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Accept-Language", "en-US")
.build();
Response response = client.newCall(request).execute();
//Java Unirest
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?")
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.header("Accept-Language", "en-US")
.asString();
var client = new RestClient("https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddHeader("Accept-Language", "en-US");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
//C LibCurl
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://smssmartegypt.com/sms/api/?username=?&password=?&sendername=?&mobiles=?&message=?");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Accept-Language: en-US");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
Make sure to replace
?with your Personal Data.
GET http://smssmartegypt.com/sms/api/<username>&<password>&<sendername>&<mobiles>&<message>
*URL Parameters
| Parameter | Description | Example |
|---|---|---|
| username | Your Username | yousef |
| password | Your Password | Y0u$ef |
| sendername | The Sender Name | Ibrahim |
| mobiles | The Receivers' Mobile Number With Code 20 |
201111111111 |
| message | The Message That You Want To Send To The Receiver | There Is A Great Offer For You |
<username>: username=?
It's returns JSON structured like this On Success:
{
"type":"success",
"msg":"Your message was sent !",
"data":{
"smsid":458281,
"sent":2,
"failed":0
}
}
Errors
Our API uses the following error codes:
| Error Code | Description |
|---|---|
| 100 | Other errors |
| 101 | Please send username and password in request! |
| 201 | Not found username or wrong password ! |
| 202 | This account is blocked ! |
| 300 | Not enough balance |
| 301 | Unapproved Sender ID |