At SMSmobileAPI, we strive to make our API as compatible as possible with any architecture or platform.
Whether you’re using REST, SOAP, cURL, or various programming languages like Python, JavaScript, PHP, and more, our API is designed to integrate seamlessly into your projects.
We also have ready-to-use plugins for e-commerce solutions and software. Click here to discover them.
If you have any questions, suggestions, or need assistance, our team is here to help.
Feel free to reach out to us at api@smsmobileapi.com
![JavaScript](https://upload.wikimedia.org/wikipedia/commons/6/6a/JavaScript-logo.png)
Send SMS & WhatsApp API
The SMSMobile API supports two authentication methods: using a simple API Key or the OAuth2 protocol with a client ID and client secret.
1. API Key Authentication for Send SMS
This method requires an API Key that can be included as a parameter in either a GET or POST request. It is a straightforward way to authenticate your API requests.
Parameters:
Example:
GET https://api.smsmobileapi.com/sendsms?apikey=YOUR_API_KEY&recipients=+1234567890&message=Hello%20World
2. OAuth2 Authentication for Send SMS
OAuth2 provides a more secure and scalable authentication method.
You will need to use a client ID and client secret to obtain an access token, which should then be included in your API requests using the Authorization header.
Download the mobile app now or access your dashboard.
Obtaining an Access Token
To get an access token, send a POST request to the token endpoint with your client ID and client secret.
curl -X POST https://api.smsmobileapi.com/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=1ab0ex4b4c1ef2c800690d" \
-d "client_secret=3ed108a93d0414074b94364290b6a7348475e93a0567005"
Using the Access Token:
Once you have the access token, include it in the Authorization header of your API requests:
curl -X POST https://api.smsmobileapi.com/sendsms \
-H "Authorization: Bearer abc123xyz456" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "recipients=+1234567890" \
-d "message=Hello"
Which Method Should You Use?
- Use API Key Authentication for quick and straightforward integrations.
- Use OAuth2 Authentication for enhanced security and scalability in your integrations.
For more details, please refer to the full documentation.
Log of SMS sent from the API
This API endpoint is used to retrieve the log of SMS messages sent via the API.
Parameter:
Get SMS received on the mobile API
This API endpoint is used to retrieve SMS messages received on the smartphone.
Parameter:
Webhook – SMS Received
This webhook system sends a POST request to the configured URL whenever an SMS is received. The system ensures real-time updates by delivering the SMS details to the specified webhook URL.
How to Configure the Webhook in the Dashboard
Follow these steps to set up your webhook URL in the dashboard:
- Log in to your account on the SMS Mobile API Dashboard.
- Navigate to the Webhook Settings section.
- Enter your webhook URL (e.g.,
https://example.com/webhook-endpoint
- Click on the Save Webhook button.
- Once saved, the system will start sending SMS details to the configured URL.
Webhook Payload
When an SMS is received, the system sends the following JSON payload to your webhook URL:
{
"date": "2025-01-20",
"hour": "10:15:00",
"time_received": "2025-01-20 10:14:50",
"message": "Hello, this is a test.",
"number": "+123456789",
"guid": "abcde12345"
}
Payload Fields:
- date: Date when the SMS was added (YYYY-MM-DD).
- hour: Hour when the SMS was added (HH:mm:ss).
- time_received: Time when the SMS was received.
- message: Content of the SMS.
- number: Sender's phone number.
- guid: Unique identifier of the SMS.
Example Webhook Endpoint
Your server should be ready to handle incoming POST requests. Below is an example PHP script to process the webhook payload:
<?php
// Read the incoming payload
$payload = file_get_contents('php://input');
$data = json_decode($payload, true);
// Process the SMS data
if ($data) {
// Example: Log the SMS data to a file
file_put_contents('sms_log.txt', print_r($data, true), FILE_APPEND);
// Respond with HTTP 200 status
http_response_code(200);
echo "Webhook received successfully.";
} else {
// Respond with HTTP 400 status for bad requests
http_response_code(400);
echo "Invalid payload.";
}
?>
Testing the Webhook
To test your webhook configuration, use tools like:
These tools allow you to inspect the payload sent by the system and debug any issues with your webhook setup.
Troubleshooting
- Ensure the webhook URL is correct and publicly accessible.
- Verify that your server is returning an HTTP 200 status code for successful requests.
- Check your server logs for any errors in processing the payload.
Delete SMS API
This API endpoint is used to delete SMS messages from the server log of SMS Mobile API
Parameter:
Note: The deleted SMS are only those stored in the logs of your mobile app account. SMS on the mobile device itself will not be deleted, as we do not have access to them.
![](https://smsmobileapi.com/wp-content/uploads/2024/08/11.jpeg)
This issue arises from a process that attempts to run in the background when the application is not actively launched. However, due to Android's battery optimization measures, which vary across different versions, this background process may not initiate correctly. Android's battery optimization is designed to limit the background activity of apps to conserve battery life, which can inadvertently affect apps that require background processes to function properly.
To address this issue, users can manually configure their Android settings to allow the SmsMobileApi to use resources without restrictions.
This involves adjusting the battery optimization settings for the specific app, essentially instructing Android that the SmsMobileApi is permitted to run in the background and use resources as needed. By doing so, the application should be able to automatically send and receive SMS messages even when it is not the active application in the foreground. This adjustment ensures that the necessary background process can operate uninterrupted, circumventing the battery optimization features that might otherwise prevent its proper execution.
![](https://smsmobileapi.com/wp-content/uploads/2024/02/step1.jpg)
![](https://smsmobileapi.com/wp-content/uploads/2024/02/step2.jpg)
FAQ For Developer
Get Started with SMSmobileAPI Today!
Experience the freedom and flexibility of managing your SMS services on the go. Download our mobile app now and take the first step towards seamless SMS integration.
Download the App