SMS Gateway API - Documentation
User Guide
Follow these steps to start using SMS Gateway:
- Install the SMS Gateway app from Google Play Store.
- Log in using your Google account to securely access the application.
- Activate your subscription to unlock full access to the API and premium features.
- Retrieve your unique API Key from the app settings.
- Integrate the API into your application, website, or automation workflow.
- Start sending SMS messages directly from your Android device.
The SMS Gateway app allows you to send order updates, appointment reminders, marketing campaigns, and even OTPs directly from your mobile device. Whether you are a developer, business owner, or marketer, this tool provides a seamless way to integrate SMS functionality into your operations.
Additionally, we provide a free WooCommerce plugin that automates SMS notifications for e-commerce stores. This ensures your customers receive timely updates about their orders, shipments, and other important notifications.
Get started now and experience the flexibility of SMS Gateway!
Recommended Device Configuration
To ensure the SMS Gateway app works reliably in the background and can send SMS messages properly, please follow these configuration steps on your Android device:
✅ 1. Allow SMS Permission
- Go to Settings > Apps > SMS Gateway > Permissions
- Enable SMS
✅ 2. Battery Usage & Optimization
- Go to Settings > Battery > Battery Usage
- Tap SMS Gateway and enable Allow background activity
- Set Battery Optimization to Not optimized
✅ 3. Mobile Data Access
- Go to Settings > Apps > SMS Gateway > Mobile Data & Wi-Fi
- Enable:
- Background data
- Unrestricted data usage
✅ 4. Remove Permissions If App is Unused
- Go to Settings > Apps > SMS Gateway
- Disable "Remove permissions and free up space"
✅ 5. OEM-specific Battery Restrictions
- Some phones (Xiaomi, Huawei, Samsung) require extra steps:
- Xiaomi: Security > Battery > App Battery Saver > SMS Gateway > No restrictions
- Huawei: Settings > Battery > App launch > SMS Gateway > Manage manually
- Samsung: Settings > Device Care > Battery > App Power Management
📌 Quick Checklist
Setting Status
SMS Permission ✅ Allowed
Background Activity (Battery) ✅ Enabled
Battery Optimization ❌ Disabled
Background Mobile Data ✅ Enabled
Unrestricted Mobile Data ✅ Enabled
Remove permissions if unused ❌ Disabled
Auto-start / Do Not Optimize ✅ Enabled
By following the instructions above, your device will allow the SMS Gateway app to receive messages and send SMS without interruptions.
API Documentation
Base URL
https://api.smstext.app
1. Send SMS
Send an SMS message using the following endpoint:
POST https://api.smstext.app/push
Request Example:
[{
"mobile": "+1234567890",
"text": "Your order #1234 has been shipped!"
}]
Response Example:
[ "e1ca36e4-0574-4a73-b829-bfdc439bbbbf" ]
2. Set Callback URL
POST https://api.smstext.app/setCallback
Request Example:
{ "callbackUrl": "https://yourdomain.com/callback" }
Confirmation: A GET request is done with the ID received at push
https://yourdomain.com/callback?correlationId=YOUR_ID
Authentication
Use Basic Authentication with your API Key:
Authorization: Basic base64_encoded(apikey:YOUR_API_KEY)
Code Examples
Python:
import requests
headers = { "Authorization": "Basic base64_encoded(apikey:YOUR_API_KEY)" }
data = [{ "mobile": "+1234567890", "text": "Hello!" }]
response = requests.post("https://api.smstext.app/push", json=data, headers=headers)
print(response.json())
JavaScript (Node.js):
const axios = require('axios');
axios.post("https://api.smstext.app/push", [{
mobile: "+1234567890", text: "Hello!"
}], {
headers: { "Authorization": "Basic base64_encoded(apikey:YOUR_API_KEY)" }
}).then(res => console.log(res.data));
PHP:
<?php
$apiKey = "YOUR_API_KEY";
$headers = array(
"Authorization: Basic " . base64_encode("apikey:" . $apiKey),
"Content-Type: application/json"
);
$data = json_encode([
[
'mobile' => $phone_number,
'text' => $message
]
]);
$ch = curl_init("https://api.smstext.app/push");
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Integration
PHP Extension
Below is the full PHP extension code (sms_gateway.php), which you need to include in your project:
sms_gateway.php
<?php
class SMSGateway {
private $apiKey;
private $apiUrl = "https://api.smstext.app/push";
public function __construct($apiKey) {
$this->apiKey = $apiKey;
}
public function sendSMS($phoneNumber, $message) {
$headers = array(
"Authorization: Basic " . base64_encode("apikey:" . $this->apiKey),
"Content-Type: application/json"
);
$data = json_encode([
[
'mobile' => $phone_number,
'text' => $message
]
]);
$ch = curl_init($this->apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
}
?>
How to Use
Include the file in your project and initialize it as follows:
include 'sms_gateway.php';
Send Order Confirmation
<?php
$apiKey = "YOUR_API_KEY";
$sms = new SMSGateway($apiKey);
$sms->sendSMS("+40712345678", "Your order #1234 has been confirmed!");
?>
Send Appointment Reminder
<?php
$sms->sendSMS("+40712345678", "Reminder: You have an appointment on March 10 at 10:00 AM.");
?>
Send OTP Code
<?php
$otp = rand(100000, 999999);
$sms->sendSMS("+40712345678", "Your OTP code is: $otp");
?>
XLSM VBA Integration
This section explains how to integrate SMS Gateway with an XLSM file using VBA.
1. Setup
Follow these steps to configure Excel (XLSM) for SMS automation:
- Open Excel and press ALT + F11 to open the VBA Editor.
- Insert a new module and paste the following VBA script:
Sub SendSMSWithDelay()
Dim ws As Worksheet
Dim i As Integer
Dim phoneNumber As String, message As String, status As String
Dim http As Object, JSON As String
Dim intervalSec As Integer
Set ws = ThisWorkbook.Sheets("Sheet1")
intervalSec = 10 ' Set delay in seconds
i = 2 ' Start from the second row
While ws.Cells(i, 1).Value <> ""
phoneNumber = ws.Cells(i, 1).Value
message = ws.Cells(i, 2).Value
status = ws.Cells(i, 3).Value
If status <> "Sent" Then
JSON = "[{\"mobile\":\"" & phoneNumber & "\",\"text\":\"" & message & "\"}]"
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "POST", "https://api.smstext.app/push", False
http.setRequestHeader "Content-Type", "application/json"
http.setRequestHeader "Authorization", "Basic " & Base64Encode("apikey:YOUR_API_KEY")
http.Send JSON
If http.Status = 200 Then
ws.Cells(i, 3).Value = "Sent"
Application.Wait (Now + TimeValue("00:00:" & intervalSec))
End If
End If
i = i + 1
Wend
End Sub
2. Automate Execution
- Go to Developer > Macros and
select
SendSMSWithDelay
. - Click Run to execute the macro.
- You can also assign this macro to a button in Excel for easy execution.
3. Using Status Column
Ensure there is a "Status" column in your sheet to prevent duplicate messages. The script marks messages as "Sent" after sending.
4. Debugging
Use Debug.Print in VBA to check response errors.
Now, SMS automation with controlled intervals in Excel VBA is ready! 🎉
Google Sheets Integration
This section explains how to integrate SMS Gateway with Google Sheets using Google Apps Script.
1. Setup
Follow these steps to configure Google Sheets for SMS automation:
- Open Google Sheets and go to Extensions > Apps Script.
- Paste the following script:
function sendSMSWithDelay() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
var data = sheet.getDataRange().getValues();
var intervalSec = 10; // Change interval (e.g., 10 seconds)
var properties = PropertiesService.getScriptProperties();
var lastProcessedRow = parseInt(properties.getProperty("lastProcessedRow")) || 1;
for (var i = lastProcessedRow; i < data.length; i++) {
var phoneNumber = data[i][0];
var message = data[i][1];
var status = data[i][2];
if (status !== "Sent") {
var options = {
"method": "post",
"headers": {
"Authorization": "Basic " + Utilities.base64Encode("apikey:YOUR_API_KEY"),
"Content-Type": "application/json"
},
"payload": JSON.stringify([{
"mobile": phoneNumber,
"text": message
}])
};
try {
var response = UrlFetchApp.fetch("https://api.smstext.app/push", options);
if (response.getResponseCode() === 200) {
sheet.getRange(i + 1, 3).setValue("Sent");
properties.setProperty("lastProcessedRow", i + 1);
Utilities.sleep(intervalSec * 1000);
}
} catch (e) {
Logger.log("Error sending to " + phoneNumber + ": " + e.toString());
}
}
}
properties.setProperty("lastProcessedRow", 1);
}
2. Automate with Triggers
- Go to Apps Script and click on the clock icon (Triggers).
- Click on + Add Trigger.
- Select function: sendSMSWithDelay.
- Event source: Time-driven.
- Set interval (e.g., every 5 minutes).
3. Using Status Column
Ensure there is a "Status" column in your sheet to prevent duplicate messages. The script marks messages as "Sent" after sending.
4. Testing & Debugging
Check logs in Apps Script by clicking View > Executions to debug errors.
5. Customization
- Modify
intervalSec
to change delay between messages. - Add a cell in Google Sheets where users can set their own interval dynamically.
Now, SMS automation with controlled intervals is ready! 🎉
Shopify Webhook Integration
Step 1: Create a Webhook in Shopify
- Go to Shopify Admin and navigate to Settings > Notifications.
- Scroll down to the Webhooks section and click Create Webhook.
- Select:
- Event: Order Creation
- Format: JSON
- URL: Your webhook script
URL (e.g.,
https://yourwebsite.com/webhook-handler.php
) - Webhook API Version: Latest available
- Click Save.
Step 2: Create the Webhook Handler
Use the following PHP script to process the webhook and send SMS notifications.
<?php
// Read data from Shopify
$data = json_decode(file_get_contents("php://input"), true);
if (!$data) {
http_response_code(400);
exit("No data received.");
}
// Extract necessary details
$customerPhone = $data['customer']['phone'] ?? null;
$orderId = $data['id'] ?? null;
$totalPrice = $data['total_price'] ?? '0.00';
if (!$customerPhone) {
http_response_code(400);
exit("No phone number found for customer.");
}
$smsMessage = "Comanda #$orderId a fost primită! Total: $$totalPrice. Vă mulțumim!";
$apiKey = "YOUR_API_KEY";
$apiUrl = "https://api.smstext.app/push";
$headers = [
"Authorization: Basic " . base64_encode("apikey:" . $apiKey),
"Content-Type: application/json"
];
$postData = json_encode(
[
[
'mobile' => $phone_number,
'text' => $message
]
]);
$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
file_put_contents("sms_log.txt", "Sent SMS to $customerPhone: $smsMessage\nResponse: $response\n", FILE_APPEND);
http_response_code(200);
exit("Webhook received and processed.");
?>
Step 3: Testing the Integration
- Place a test order in Shopify with a valid phone number.
- Check the
sms_log.txt
file to confirm the message was sent. - Monitor SMS deliveries through SMS Gateway API.
PrestaShop Integration
Integrate SMS Gateway with PrestaShop for real-time SMS notifications.
Method 1: Webhook (Instant SMS Notifications)
This method sends SMS immediately when a new order is placed.
- Go to **PrestaShop Admin Panel**.
- Navigate to Advanced Parameters > Webservice and enable web services.
- Create a webhook that triggers when a new order is placed.
- Configure the webhook to send data to a custom PHP script.
PHP Webhook Script (save as
webhook_sms.php
)
Place this file on your server and configure the webhook in PrestaShop to call it.
<?php
$data = json_decode(file_get_contents("php://input"), true);
$phone = $data['customer']['phone'];
$id_order = $data['id_order'];
$message = "Order #$id_order has been received!";
$apiKey = "YOUR_API_KEY";
$apiUrl = "https://api.smstext.app/push";
$headers = [
"Authorization: Basic " . base64_encode("apikey:" . $apiKey),
"Content-Type: application/json"
];
$postData = json_encode([
"mobile" => $phone,
"text" => $message
]);
$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
file_put_contents("sms_log.txt", "Sent SMS to $phone: $message\nResponse: $response\n", FILE_APPEND);
?>
Where to place this file?
- Upload
webhook_sms.php
to your web server. - Set your PrestaShop webhook to call
https://yourdomain.com/webhook_sms.php
. - Ensure the file has proper permissions and can be accessed by the webhook.
Advantages: Instant SMS sending, no delay.