Turns your smartphone into an SMS gateway for sending messages via API.
Explore the docs »
Report Bug
·
Request Feature
SMS Gateway turns your Android smartphone into an SMS gateway. It's a lightweight application that allows you to send SMS messages programmatically via an API or CLI tool and receive webhooks on incoming SMS. This makes it ideal for integrating SMS functionality into your own applications or services.
- No registration required: No registration or email is required to create an account. In local mode, you don't need an account at all!
- Send SMS via API: Use our API to send messages directly from your applications or services.
- Support for Android 5.0 and above: The application is compatible with Android 5.0 and later versions.
- Message status tracking: Monitor the status of sent messages in real-time.
- Automatic startup: The application starts running as soon as your device boots up.
- Support for multiple SIM cards: The application supports devices with multiple SIM cards.
- Multipart messages: The application supports sending long messages with auto-partitioning.
- End-to-end encryption: The application provides end-to-end encryption by encrypting message content and recipients' phone numbers before sending them to the API and decrypting them on the device.
- Message expiration: The application allows setting an expiration time for messages. Messages will not be sent if they have expired.
- Random delay between messages: Introduces a random delay between sending messages to avoid mobile operator restrictions.
- Private server support: The application allows for the use of a backend server in the user's infrastructure for enhanced security.
- App status reporting: Ability to report current app status by sending requests to specified URL at any user-defined intervals.
- Webhooks on incoming SMS: The application allows setting up webhooks to be sent to a specified URL whenever an SMS is received.
- Authentication & Verification: Secure user accounts and transactions with SMS-based two-factor authentication, minimizing the risk of unauthorized access.
- Transactional Messages: Send confirmation messages for user actions, enhancing the reliability and perception of your brand.
- SMS Reminders: Prompt users about upcoming events or appointments to ensure engagement and reduce missed opportunities.
- SMS Notifications: Deliver immediate notifications to users for important updates, offers, and service enhancements.
- User Feedback: Solicit and collect user feedback through SMS, providing valuable insights for improving your services.
Note: It is not recommended to use this for batch sending due to potential mobile operator restrictions.
You can install app to your device from prebuilt APK or by building from sources.
You need an Android device with Android 5.0 (Lollipop) or above for using the application.
To use the application, you need to grant the following permissions:
- SEND_SMS: This permission is required to send SMS messages.
- READ_PHONE_STATE: This permission is optional. If you want to select the SIM card, you can grant this permission.
- RECEIVE_SMS: This permission is optional. If you want to receive webhooks on incoming SMS, you need to grant this permission.
- Navigate to the Releases page.
- Download the latest APK file from the list of available releases.
- Transfer the APK file to your Android device.
- On your Android device, go to Settings > Security (or Privacy on some devices).
- Enable the Unknown sources option to allow installation of apps from sources other than the Play Store.
- Use a file manager app to navigate to the location of the downloaded APK file.
- Tap on the APK file to start the installation process.
- Follow the on-screen prompts to complete the installation.
For integration examples, please refer to the CLI Tool Documentation and API Documentation
The SMS Gateway for Android can work in two modes: with a Local Server started on the device or with a Cloud Server. The basic API is the same for both modes and is documented on the SMS Gateway for Android API Documentation page.
This mode is ideal for sending messages from a local network.
-
Launch the app on your device.
-
Toggle the
Local Server
switch to the "on" position. -
Tap the
Offline
button at the bottom of the screen to activate the server. -
In the
Local Server
section, your device's local and public IP addresses will be displayed, along with the credentials for basic authentication. Note that the public IP address is only accessible if you have a public (or "white") IP and your firewall is configured correctly. -
To send a message from within the local network, execute a
curl
command like the one below. Replace<username>
,<password>
, and<device_local_ip>
with the actual values provided in the previous step:curl -X POST -u <username>:<password> \ -H "Content-Type: application/json" \ -d '{ "message": "Hello, doctors!", "phoneNumbers": ["+19162255887", "+19162255888"] }' \ http://<device_local_ip>:8080/message
Alternatively, you can use the CLI Tool:
smsgate -e 'http://<device_local_ip>:8080/message' -u <username> -p <password> \ send --phones '+19162255887,+19162255888' 'Hello, doctors!'
Use the cloud server mode when dealing with dynamic or shared device IP addresses.
-
Launch the app on your device.
-
Toggle the
Cloud Server
switch to the "on" position. -
Tap the
Online
button located at the bottom of the screen to connect to the cloud server. -
In the
Cloud Server
section, the credentials for basic authentication will be displayed. -
To send a message via the cloud server, perform a
curl
request with a command similar to the following, substituting<username>
and<password>
with the actual values obtained in step 4:curl -X POST -u <username>:<password> \ -H "Content-Type: application/json" \ -d '{ "message": "Hello, doctors!", "phoneNumbers": ["+19162255887", "+19162255888"] }' \ https://api.sms-gate.app/3rdparty/v1/message
Or with CLI:
```sh
smsgate -u <username> -p <password> \
send --phones '+19162255887,+19162255888' 'Hello, doctors!'
```
For further privacy, you can deploy your own private server. See the Private Server section for more details.
Webhooks can be utilized to get notifications of incoming SMS messages.
Follow these steps to set up webhooks:
-
Set up your own HTTP server with a valid SSL certificate to receive webhooks. For testing purposes, webhook.site can be useful.
-
Register your webhook with an API request:
curl -X POST -u <username>:<password> \ -H "Content-Type: application/json" \ -d '{ "id": "unique-id", "url": "https://webhook.site/<your-uuid>", "event": "sms:received" }' \ http://<device_local_ip>:8080/webhooks
-
Send an SMS to the device.
-
The application will dispatch POST request to the specified URL with a payload such as:
{ "event": "sms:received", "payload": { "message": "Received SMS text", "phoneNumber": "+19162255887", "receivedAt": "2024-06-07T11:41:31.000+07:00" } }
-
To deregister a webhook, execute a
curl
request using the following pattern:curl -X DELETE -u <username>:<password> \ http://<device_local_ip>:8080/webhooks/unique-id
For cloud mode the process is similar, simply change the URL to https://api.sms-gate.app/3rdparty/v1/webhooks. Webhooks in Local and Cloud mode are independent.
Note: Webhooks are transmitted directly from the device; therefore, the device must have an outgoing internet connection. As the requests originate from the device, incoming messages remain inaccessible to us.
- Add functionality to modify user credentials.
- Introduce option to adjust the local server port.
- Send notifications to an external server when the status of a message changes.
- Incorporate scheduling capabilities for dispatching messages at specific times.
- Implement region-based restrictions to prevent international SMS.
- Provide an API endpoint to retrieve the list of available SIM cards on the device.
- Include detailed error messages in responses and logs.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Apache-2.0 license. See LICENSE for more information.
If you have any questions or suggestions, feel free to reach out through the following channels:
- Issue Tracker: https://github.com/capcom6/android-sms-gateway/issues
- Email: support@sms-gate.app
- Discord: Join our Discord server
- Website: https://sms-gate.app
- Project: https://github.com/android-sms-gateway
- Main Repository: https://github.com/capcom6/android-sms-gateway
- Author GitHub: capcom6