If you need to secure access to your systems and are looking for how to configure multiOTP send SMS to send two-step verification (2FA) codes, you've come to the right place. In this guide, we will show you in detail how to integrate multiOTP with MySMSGate to send SMS using your own Android mobile phone and SIM card, avoiding the expensive rates and regulatory hurdles of traditional providers like Twilio.
What is multiOTP and why is MySMSGate integration the best choice?
multiOTP is one of the most popular and powerful open-source tools for implementing dual-factor authentication (2FA) in network infrastructures, VPN servers, Windows logins, and Active Directory systems. However, for SMS-based one-time password (OTP) authentication to work, multiOTP requires a connection to an external SMS gateway.
Traditionally, system administrators turned to giants like Twilio or Plivo. The current problem is that these platforms impose huge entry barriers for small and medium-sized enterprises: mandatory campaign registrations (A2P 10DLC), approvals that take weeks, monthly fees for virtual numbers, and charges per 160-character segment that quickly inflate bills. If you want to explore other options, we recommend reading our comparison of Twilio alternatives in 2026.
This is where MySMSGate makes a difference. By acting as a communication bridge, it allows you to send messages directly from your own Android phone using your local SIM card. This offers incomparable advantages:
- No regulatory approvals: You don't need to register A2P campaigns or wait for carrier authorizations. You send from your own phone number that your users already recognize.
- Flat and transparent rate: You pay only $0.02 per successfully sent SMS. There are no monthly fees, minimum contracts, or hidden charges. Additionally, if an SMS fails, the balance is automatically refunded.
- Simplified billing: Unlike Twilio, we charge a single fee per message regardless of its length, avoiding bill surprises for messages exceeding 160 characters.
Configuration Prerequisites
Before starting the technical integration, make sure you have the following items ready for use:
- An active MySMSGate account: You can register quickly from our free account creation portal.
- An Android phone with an active SIM card: The device will function as your physical SMS gateway. We recommend it has good coverage and a suitable messaging plan.
- The MySMSGate application installed: Download our app on your Android, log in by scanning the QR code from your dashboard, and the phone will be linked instantly. For more details on this step, consult our guide on how to send SMS from an Android phone via API.
- A multiOTP installation: Either in its command-line version (CLI) or integrated into systems like pfSense, OPNsense, or Active Directory.
Step by step: Configure multiOTP send SMS via a custom script
multiOTP allows you to execute external commands or custom scripts to send SMS. Since the MySMSGate API requires a secure HTTP POST request with JSON format, the cleanest and most robust way to perform the integration is to create a small intermediate script that multiOTP will execute every time it needs to dispatch an OTP code.
Step 1: Create the sending script in PHP or Bash
Below, we provide an example script in PHP that takes the arguments sent by multiOTP (the phone number and the text message) and transmits them to the MySMSGate API:
<?php
// Save this file as /usr/local/bin/send-mysmsgate.php
if ($argc < 3) {
echo "Usage: php send-mysmsgate.php [phone] [message]\n";
exit(1);
}
$phone = $argv[1];
$message = $argv[2];
$token = "YOUR_MYSMSGATE_API_KEY"; // Replace with your real token
$url = "https://mysmsgate.net/api/v1/send";
$data = [
"token" => $token,
"to" => $phone,
"message" => $message
];
$options = [
"http" => [
"header" => "Content-Type: application/json\r\n",
"method" => "POST",
"content" => json_encode($data),
"ignore_errors" => true
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
echo "Error connecting to the MySMSGate API.\n";
exit(1);
}
$response = json_decode($result, true);
if (isset($response['success']) && $response['success'] === true) {
echo "SMS sent successfully.\n";
exit(0);
} else {
echo "Sending failed: " . ($response['error'] ?? 'Unknown error') . "\n";
exit(1);
}
?>Don't forget to grant execution permissions to the script on your server with the command chmod +x /usr/local/bin/send-mysmsgate.php.
Step 2: Link the script inside multiOTP
Once the script is ready and tested, you must tell multiOTP to use it as its default messaging provider. Open your terminal where you have multiOTP configured and run the following configuration command:
multiotp -config sms-sender-path="/usr/local/bin/send-mysmsgate.php" sms-sender-parameters="%NUMBER% %TEXT%"With this adjustment, every time a user tries to authenticate and requires a one-time code, multiOTP will automatically call your script, passing the user's phone number in the %NUMBER% parameter and the generated code in %TEXT%.
Diving deeper into mss web api how to configure
If you are specifically looking for mss web api how to configure, it is crucial to understand how to interact directly with our endpoint for custom integrations beyond multiOTP. The MySMSGate REST API is designed to be extremely simple and straightforward, ideal for both system administrators and independent developers.
The MySMSGate API exposes a single main endpoint for sending messages:
- Endpoint:
POST https://mysmsgate.net/api/v1/send - Data Format: JSON
Below is an example of how to configure a direct request using cURL from the command line:
curl -X POST https://mysmsgate.net/api/v1/send \
-H "Content-Type: application/json" \
-d '{
"token": "YOUR_API_KEY_HERE",
"to": "+34600000000",
"message": "Your multiOTP verification code is: 582910"
}'If you use a phone with Dual SIM support, you can even specify which SIM card slot you want to send the message from by adding the optional parameter "sim_slot": 1 or "sim_slot": 2 in the JSON body. This allows you to optimize costs if you have different rates depending on the destination operator.
Advanced Management: how to configure a webhook to send sms from sim card
Many administrators wonder how to configure a webhook to send sms from sim card in order to track delivery status in real-time or capture user responses. MySMSGate not only sends messages but also allows for two-way communication.
When you send an SMS through your Android's SIM card, the message goes through different states (queued, sent, delivered, or failed). To receive these status updates on your multiOTP or monitoring server, you can configure a delivery webhook from your MySMSGate dashboard:
- Log in to mysmsgate.net and go to the API Settings section.
- In the Delivery Status Webhook field, enter your server's URL (for example,
https://your-domain.com/webhooks/sms-status). - MySMSGate will send a real-time POST request every time the SMS status changes on the physical Android device.
Likewise, if a user replies to the verification SMS or sends a text message to your SIM card, MySMSGate will capture that incoming message and automatically forward it to your configured webhook, allowing for full interactivity directly from your web console.
Cost and Feature Comparison: MySMSGate vs. Twilio
For small businesses, medical offices, training schools, and local businesses, the fixed costs of traditional gateways are hard to justify. Let's analyze how MySMSGate compares to standard market solutions in a low-to-medium volume scenario (approx. 500 monthly SMS for alerts and OTP):
| Feature / Cost | MySMSGate | Twilio / Traditional Providers |
|---|---|---|
| Cost per sent SMS | $0.02 (Flat rate) | $0.05 - $0.08 + carrier fees |
| Monthly cost per number | $0.00 (You use your own number) | $1.15 - $2.00 monthly |
| Campaign registration (A2P 10DLC) | Not required | Required (registration fee + monthly fee) |
| Charge per message length | Single rate per complete message | Charged per 160-character segments |
| Dual SIM / Multi-device support | Yes, unlimited devices connected | Not available (virtual numbers only) |
| Refund for network failures | Yes, balance auto-refunded | No, the sending attempt is charged |
As seen in the table, MySMSGate stands out as the cheapest SMS API for small businesses looking for simplicity, full control over their sender, and predictable budgets without long-term contracts.
Frequently Asked Questions
Below, we answer the most common questions from users configuring dual-factor systems and Android-based SMS gateways.
Is it safe to send OTP codes through an Android phone with MySMSGate?
Yes, it is completely safe. The communication between your multiOTP server, the MySMSGate API, and your Android device is encrypted using secure HTTPS protocols. Furthermore, by sending messages from your own physical SIM card, you avoid the spam filters that often block virtual numbers from large A2P providers.
What happens if my Android phone enters sleep or standby mode?
The MySMSGate mobile app features an optimized auto wake-up system via Google push notifications. This ensures that even if the device enters deep sleep mode to save battery, it will reactivate immediately upon receiving a send command from your multiOTP server.
Can I connect multiple Android phones to the same multiOTP account?
Yes. From the MySMSGate dashboard, you can connect an unlimited number of Android devices to a single account. When making the API request, you can specify the device_id parameter to dynamically decide through which phone and geographic number the verification code should be transmitted.
How are balances and payments handled in MySMSGate?
We operate under an extremely simple prepaid model without recurring subscriptions. You can top up balance packages according to your needs (for example, 250 SMS for $5.00, 500 SMS for $10.00, or 1000 SMS for $20.00). The balance does not expire and is only deducted when a message is successfully transmitted to your telephone operator.
Comments (0)
Be the first to comment!