Get started
API Endpoint:
https://swiftsms.macroit.org/api/send_message
Body Format: Raw
{
"sender_id": "MACRO-IT",
"numbers": "0973750029,0769891754",
"message": "Good afternoon"
}
Bulk SMS APIs are programming interfaces that allow developers to integrate bulk SMS functionality into their applications or systems. These APIs provide a set of methods and protocols that enable the sending and receiving of SMS messages in large quantities.
To use this in real world, you need a Bearer Token and a Sender Id. Please create an account with
us and make your token and sender Id in the developers dashboard.
get characters
# Here is a curl example
curl --location --request GET 'https://swiftsms.macroit.org/api/send_message' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer PWoKyVBMIRh8wfQR2eCw8TOZ2MNmzCd7h9ikOSX2' \
--data-raw '{
"sender_id": "MACRO-IT",
"numbers": "00973750029,00769891754",
"message": "Good afternoon"
}
'
QUERY PARAMETERS
Field |
Type |
Description |
Method |
Authorization |
String |
Your Bearer token. |
GET |
Content-Type |
String |
application/json |
|
Accept |
String |
application/json |
|
get characters
# Here is a c-sharp-restC# example
var client = new RestClient("https://swiftsms.macroit.org/api/send_message");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
request.AddHeader("Authorization", "Bearer PWoKyVBMIRh8wfQR2eCw8TOZ2MNmzCd7h9ikOSX2");
var body = @"{
" + "\n" +
@" ""sender_id"": ""MACRO-IT"",
" + "\n" +
@" ""numbers"": ""0973750029,0769891754"",
" + "\n" +
@" ""message"": ""Good afternoon""
" + "\n" +
@"}
" + "\n" +
@"";
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
QUERY PARAMETERS
Field |
Type |
Description |
Authorization |
String |
Your Bearer token. |
Content-Type |
String |
application/json |
|
Accept |
String |
application/json |
|
get characters
# Here is a JAVA Http example
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"sender_id\": \"MACRO-IT\",\r\n \"numbers\": \"00973750029,00769891754\",\r\n \"message\": \"Good afternoon\"\r\n}\r\n");
Request request = new Request.Builder()
.url("https://swiftsms.macroit.org/api/send_message")
.method("GET", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer PWoKyVBMIRh8wfQR2eCw8TOZ2MNmzCd7h9ikOSX2")
.build();
Response response = client.newCall(request).execute();
QUERY PARAMETERS
Field |
Type |
Description |
Authorization |
String |
Your Bearer token. |
Content-Type |
String |
application/json |
|
Accept |
String |
application/json |
|
get characters
# Here is a Js example
// WARNING: For GET requests, body is set to null by browsers.
var data = JSON.stringify({
"sender_id": "MACRO-IT",
"numbers": "00973750029,00769891754",
"message": "Good afternoon"
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://swiftsms.macroit.org/api/send_message");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Authorization", "Bearer PWoKyVBMIRh8wfQR2eCw8TOZ2MNmzCd7h9ikOSX2");
xhr.send(data);
QUERY PARAMETERS
Field |
Type |
Description |
Authorization |
String |
Your Bearer token. |
Content-Type |
String |
application/json |
|
Accept |
String |
application/json |
|
get characters
# Here is the OBJECTIVE-C Example
#import
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://swiftsms.macroit.org/api/send_message"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
NSDictionary *headers = @{
@"Content-Type": @"application/json",
@"Accept": @"application/json",
@"Authorization": @"Bearer PWoKyVBMIRh8wfQR2eCw8TOZ2MNmzCd7h9ikOSX2"
};
[request setAllHTTPHeaderFields:headers];
NSData *postData = [[NSData alloc] initWithData:[@"{\r\n \"sender_id\": \"MACRO-IT\",\r\n \"numbers\": \"00973750029,00769891754\",\r\n \"message\": \"Good afternoon\"\r\n}\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:postData];
[request setHTTPMethod:@"GET"];
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);
Field |
Type |
Description |
Authorization |
String |
Your Bearer token. |
Content-Type |
String |
application/json |
|
Accept |
String |
application/json |
|
get characters
# Here is a PHP cURL example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://swiftsms.macroit.org/api/send_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 => 'GET',
CURLOPT_POSTFIELDS =>'{
"sender_id": "MACRO-IT",
"numbers": "0973750029,0769891754",
"message": "Good afternoon"
}
',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer PWoKyVBMIRh8wfQR2eCw8TOZ2MNmzCd7h9ikOSX2'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
QUERY PARAMETERS
Field |
Type |
Description |
Authorization |
String |
Your Bearer token. |
Content-Type |
String |
application/json |
|
Accept |
String |
application/json |
|
get characters
# Here is a PYTHON Http example
import http.client
import json
conn = http.client.HTTPSConnection("swift-sms.net", )
payload = json.dumps({
"sender_id": "MACRO-IT",
"numbers": "00973750029,00769891754",
"message": "Good afternoon"
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer PWoKyVBMIRh8wfQR2eCw8TOZ2MNmzCd7h9ikOSX2'
}
conn.request("GET", "/api/send_message", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
QUERY PARAMETERS
Field |
Type |
Description |
Authorization |
String |
Your Bearer token. |
Content-Type |
String |
application/json |
|
Accept |
String |
application/json |
|
get characters
# Here is a RUBY example
require "uri"
require "json"
require "net/http"
url = URI("https://swiftsms.macroit.org/api/send_message")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Authorization"] = "Bearer PWoKyVBMIRh8wfQR2eCw8TOZ2MNmzCd7h9ikOSX2"
request.body = JSON.dump({
"sender_id": "MACRO-IT",
"numbers": "0973750029,0769891754",
"message": "Good afternoon"
})
response = http.request(request)
puts response.read_body
QUERY PARAMETERS
Field |
Type |
Description |
Authorization |
String |
Your Bearer token. |
Content-Type |
String |
application/json |
|
Accept |
String |
application/json |
|
Success
The SWIFT-SMS API uses the following success status codes:
Status Code |
Meaning |
202 |
Accepted. Request Accepted For Delivery
|
Errors
The SWIFT-SMS API uses the following error codes:
Error Code |
Meaning |
401 |
Unauthenticated
|
422 |
Unprocessable entity
|
500 |
INTERNAL_PROCESSING_ERROR
|