SMS Documentation
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.
Send SMS
This endpoint allows you to send an SMS from your mobile phone.Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your unique API key. |
| recipients | Required The recipient's phone number. |
| message | Required The message to send (no 160-char limit). |
| port |
Define the SIM port to use for sending the SMS: 1, 2, or leave it empty. If left empty, the SMS will be sent using the available SIM port automatically. This parameter is available starting from Android version 4.1.15.0 and works when the app is in the foreground. |
| shorturl | 1 = convert URLs to short links 0 or empty = no conversion |
| sIdentifiant | Select which connected phone sends the SMS. Leave empty for first available device. Requires app 3.0.35.3+. |
| sendwa | 1 = send via WhatsApp. |
| sendsms | 1 = send via SMS (default if empty). Set to 0 to block SMS. |
| encrypt_message | yes = recipient needs a key to decrypt. Learn more |
| schedule_timestamp | UNIX timestamp (GMT 0) from which the SMS should be sent. |
Example request:
GET https://api.smsmobileapi.com/sendsms/?apikey=YOUR_API_KEY&recipients=+1234567890&message=Hello%20World
Example JSON response:
{
"result": {
"error": 0,
"sent": "1",
"id": "c319d3b35e8f8712cde20dae39ac3c19f86eda25",
"note": "sent by mobile",
"datetime": "2026-03-20T21:07:44Z",
"datetimeLocal": "2026-03-20T22:07:44+01:00",
"port": null,
"iac_control": "1",
"iac_authorized": "1",
"send_with_whatsapp": "0",
"encrypted": {
"status": "0"
},
"trial_account": {
"status": "0",
"sms_sent": 0
}
}
}
Response explanation:
| Field | Description |
|---|---|
| result.error | 0 = no error. If another value is returned, the request failed or was blocked. |
| result.sent | 1 = the message has been accepted for sending by the mobile. |
| result.id | Unique message identifier generated by the API. You can store it for tracking or logging. |
| result.note | Additional information about how the message was processed. Example: sent by mobile. |
| result.datetime | UTC date/time of the API response. |
| result.datetimeLocal | Local date/time based on the mobile or server configuration. |
| result.port | SIM port used for sending. Can be 1, 2, or null if not specified or not returned. |
| result.iac_control | Internal API control status. 1 means the request passed internal validation checks. |
| result.iac_authorized | 1 means the API key is authorized to use this endpoint. |
| result.send_with_whatsapp | 1 = the message is processed via WhatsApp. 0 = standard SMS sending. |
| result.encrypted.status | 1 = encryption enabled. 0 = message sent without encryption. |
| result.trial_account.status | 1 = the account is a trial account. 0 = regular account. |
| result.trial_account.sms_sent | Number of SMS already sent from the trial account, when relevant. |
Resend an unsent SMS
This endpoint allows you to resend a previously unsent SMS, only if the message is currently in an error status.
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your unique API key. |
| guid | Required GUID of the message to resend. |
Example request:
GET https://api.smsmobileapi.com/resend/?apikey=YOUR_API_KEY&guid=GUID_OF_THE_MESSAGE
Example JSON response:
{
"result": {
"error": "0",
"sms": "resent with successfully",
"attempt": 1
}
}
Response explanation:
| Field | Description |
|---|---|
| result.error | 0 = no error. The resend request was accepted successfully. |
| result.sms | Status message returned by the API. In this example, it confirms that the SMS was resent successfully. |
| result.attempt | Indicates the resend attempt number. |
Log of SMS sent from the API
This endpoint allows you to retrieve the log of SMS messages sent through the API.
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your unique API key. |
| guid_message | Filter by the unique message identifier. |
| before | Retrieve messages sent before this value. Depending on your implementation, this can be a timestamp or a message reference. |
| error_api | 1 = only list SMS messages with an API request error. |
| error_mobile | 1 = only list SMS messages with a mobile processing error. |
| keyword | Filter by recipient number or message content. |
Example request:
GET https://api.smsmobileapi.com/log/sent/sms/?apikey=YOUR_API_KEY
Example JSON response:
{
"result": {
"error": "0",
"sms": [
{
"sIdentifiantPhone": "abbg00055x5",
"port": 0,
"date_add": "2026-03-20",
"hour_add": "22:07:44",
"timestamp": 1774044464,
"send_from_mobile": 1,
"send_from_mobile_date": "2026-03-20",
"send_from_mobile_heure": "22:10:05",
"send_from_mobile_timestamp": 1774044605,
"recipients": "32495898697",
"sms": "test",
"error_api": "",
"send_from_mobile_erreur": "",
"guid_message": "c319d3b35e8f8712cde20dae39ac3c19f86eda25",
"timearea": "UTC+01",
"date_add_server": "2026-03-20",
"hour_add_server": "21:07:44",
"timestamp_server": 1774040864,
"send_from_mobile_date_server": "2026-03-20",
"send_from_mobile_heure_server": "21:10:05"
}
]
}
}
Response explanation:
| Field | Description |
|---|---|
| result.error | 0 = no error. The request was processed successfully. |
| result.sms | Array containing the sent SMS log entries returned by the API. |
| result.sms[].sIdentifiantPhone | Identifier of the phone used for sending, when available. |
| result.sms[].port | SIM port used for sending the SMS. |
| result.sms[].date_add | Local date when the SMS was added to the queue. |
| result.sms[].hour_add | Local time when the SMS was added to the queue. |
| result.sms[].timestamp | UNIX timestamp of the local queued date/time. |
| result.sms[].send_from_mobile | 1 = the SMS was sent from the mobile. 0 = not yet sent or failed before sending. |
| result.sms[].send_from_mobile_date | Local date when the mobile actually sent the SMS. |
| result.sms[].send_from_mobile_heure | Local time when the mobile actually sent the SMS. |
| result.sms[].send_from_mobile_timestamp | UNIX timestamp of the actual sending time from the mobile. |
| result.sms[].recipients | Recipient phone number. |
| result.sms[].sms | Content of the message. |
| result.sms[].error_api | Error returned during API request processing, if any. Empty means no API error. |
| result.sms[].send_from_mobile_erreur | Error returned by the mobile during sending, if any. Empty means no mobile error. |
| result.sms[].guid_message | Unique message GUID. |
| result.sms[].timearea | Time zone used for the local date and time fields. |
| result.sms[].date_add_server | Server-side date when the SMS was added. |
| result.sms[].hour_add_server | Server-side time when the SMS was added. |
| result.sms[].timestamp_server | Server-side UNIX timestamp when the SMS was added. |
| result.sms[].send_from_mobile_date_server | Server-side date when the SMS was sent by the mobile. |
| result.sms[].send_from_mobile_heure_server | Server-side time when the SMS was sent by the mobile. |
List sent SMS from mobile
This endpoint allows you to list SMS messages sent from your mobile device and synchronized to your SMSMobileAPI account.
Important: This feature is available starting from Android version 4.1.20.
Important: This feature is not enabled by default in the Android app.
Privacy: All synchronized information is anonymized, confidential, and handled securely.
History limit: This API only returns data from the last 7 days.
Note: If you send SMS using the standard API endpoint https://api.smsmobileapi.com/sendsms/, these SMS may also appear in this listing because they are physically sent from your mobile device.
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your unique API key. |
| date | Optional. Exact date filter in YYYY-MM-DD format. |
| date_from | Optional. Start date of the period in YYYY-MM-DD format. |
| date_to | Optional. End date of the period in YYYY-MM-DD format. |
| period | Optional. Predefined period filter. Allowed values: today, yesterday, last_24h, last_3days, last_7days. |
| number | Optional. Filter by recipient phone number. |
| sIdentifiant | Optional. Filter by mobile identifier. |
| message | Optional. Filter by SMS content. |
| search | Optional. Global search on sIdentifiant, number, message, mobile_date_formatted, and synchro_time. |
| sort_by | Optional. Sorting field. Allowed values: sIdentifiant, number, message, mobile_date_ms, mobile_date_formatted, synchro_time. |
| sort_order | Optional. Sorting order: ASC or DESC. |
| limit | Optional. Maximum number of returned rows. Maximum allowed value: 200. |
Returned fields:
| Field | Description |
|---|---|
| sIdentifiant | Mobile identifier linked to the sent SMS. |
| number | Recipient phone number. |
| message | SMS content. |
| mobile_date_ms | Original SMS timestamp in milliseconds. |
| mobile_date_formatted | Formatted date received from the mobile device. |
| synchro_time | Date and time when the SMS was synchronized to SMSMobileAPI. |
Example request:
GET https://api.smsmobileapi.com/log/sent/frommobile/?apikey=YOUR_API_KEY
Example with filters:
GET https://api.smsmobileapi.com/log/sent/frommobile/?apikey=YOUR_API_KEY&date=2026-03-13&number=+15551234567&sort_by=synchro_time&sort_order=DESC
Example with predefined period:
GET https://api.smsmobileapi.com/log/sent/frommobile/?apikey=YOUR_API_KEY&period=last_7days&limit=200
Example JSON response:
{
"result": {
"error": "0",
"count": 200,
"limit": 200,
"history_limit_days": 7,
"sort_by": "mobile_date_ms",
"sort_order": "DESC",
"sms": [
{
"sIdentifiant": "508b004b4aadacc4",
"number": "+15551234567",
"message": "Hello, your appointment has been confirmed.",
"mobile_date_ms": 1774041004692,
"mobile_date_formatted": "2026-03-20 22:10:04",
"synchro_time": "2026-03-20 21:10:05"
},
{
"sIdentifiant": "e5b70a8a28b2ec3d",
"number": "+447700900123",
"message": "Your verification code is 482915.",
"mobile_date_ms": 1774040902284,
"mobile_date_formatted": "2026-03-20 22:08:22",
"synchro_time": "2026-03-20 21:08:35"
},
{
"sIdentifiant": "e5b70a8a28b2ec3d",
"number": "+33198765432",
"message": "Thank you for your order. It is now being processed.",
"mobile_date_ms": 1774026491230,
"mobile_date_formatted": "2026-03-20 18:08:11",
"synchro_time": "2026-03-20 17:19:19"
}
]
}
}
Response explanation:
| Field | Description |
|---|---|
| result.error | 0 = no error. The request was processed successfully. |
| result.count | Number of SMS entries returned in the current response. |
| result.limit | Maximum number of rows requested or applied by the API. |
| result.history_limit_days | Maximum history range available through this endpoint, in days. |
| result.sort_by | Sorting field applied to the response. |
| result.sort_order | Sorting direction applied to the response: ASC or DESC. |
| result.sms | Array containing the synchronized SMS entries sent from the mobile device. |
| result.sms[].sIdentifiant | Identifier of the mobile device that sent the SMS. |
| result.sms[].number | Recipient phone number. |
| result.sms[].message | Content of the SMS message. |
| result.sms[].mobile_date_ms | Original mobile timestamp in milliseconds. |
| result.sms[].mobile_date_formatted | Human-readable date and time from the mobile device. |
| result.sms[].synchro_time | Date and time when the SMS entry was synchronized to SMSMobileAPI. |
SMS Received
This endpoint allows you to retrieve SMS messages received on the smartphone.
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your unique API key. |
| sIdentifiantPhone | Optional. Filter messages received on a specific linked phone. |
| after_timestamp_unix | Optional. Retrieve only SMS received after a given UNIX timestamp. |
| onlyunread | yes = return only messages not yet marked as read by the API status. |
Example request:
GET https://api.smsmobileapi.com/getsms/?apikey=YOUR_API_KEY
Example JSON response:
{
"result": {
"error": "",
"sms": [
{
"id": 466340,
"sIdentifiantPhone": "e5b70a8a28b2ec3d",
"date": "2026-03-20",
"hour": "21:23:34",
"timestamp_unix": 1774041814,
"time_received": "20260320222332804",
"indice": "27593",
"message": "Hello, your package has been delivered.",
"number": "+15551234567",
"guid": "6BFD7DC7-3492-422D-8D02-4AF4E614F122",
"alias": null,
"apikey": "YOUR_API_KEY_HASH"
},
{
"id": 466341,
"sIdentifiantPhone": "e5b70a8a28b2ec3d",
"date": "2026-03-20",
"hour": "21:23:34",
"timestamp_unix": 1774041814,
"time_received": "20260320221005892",
"indice": "27591",
"message": "Your appointment is confirmed for tomorrow.",
"number": "+447700900123",
"guid": "BF3B38D7-8401-4A8C-8BA6-D8D58ACBB23E",
"alias": null,
"apikey": "YOUR_API_KEY_HASH"
},
{
"id": 466324,
"sIdentifiantPhone": "e5b70a8a28b2ec3d",
"date": "2026-03-20",
"hour": "21:08:24",
"timestamp_unix": 1774040904,
"time_received": "20260320220822763",
"indice": "27590",
"message": "Please call us back when available.",
"number": "+33198765432",
"guid": "08C88E20-9B98-453F-B361-9BB06D3275D6",
"alias": null,
"apikey": "YOUR_API_KEY_HASH"
},
{
"id": 466156,
"sIdentifiantPhone": "e5b70a8a28b2ec3d",
"date": "2026-03-20",
"hour": "19:05:22",
"timestamp_unix": 1774033522,
"time_received": "20260320200026246",
"indice": "27588",
"message": "Reminder: your account review is pending.",
"number": "10001",
"guid": "551B2CF4-9330-4DD2-B2BA-5A4026EEEB15",
"alias": null,
"apikey": "YOUR_API_KEY_HASH"
}
]
}
}
Response explanation:
| Field | Description |
|---|---|
| result.error | Empty value usually means no error was returned by the API. |
| result.sms | Array containing the received SMS entries. |
| result.sms[].id | Internal unique identifier of the received SMS entry. |
| result.sms[].sIdentifiantPhone | Identifier of the phone that received the SMS. |
| result.sms[].date | Date when the SMS was received. |
| result.sms[].hour | Time when the SMS was received. |
| result.sms[].timestamp_unix | UNIX timestamp of the received SMS. |
| result.sms[].time_received | Original internal reception timestamp provided by the mobile/app. |
| result.sms[].indice | Internal message index or reference from the synchronization process. |
| result.sms[].message | Content of the received SMS. |
| result.sms[].number | Sender phone number or shortcode. |
| result.sms[].guid | Unique GUID assigned to the received SMS. |
| result.sms[].alias | Optional alias associated with the sender, if available. Can be null. |
| result.sms[].apikey | API key associated with the message record. In documentation examples, this value should be masked. |
Mark SMS Messages Received as Read
This API endpoint is used to mark one received SMS message as read in the API status only.
This does not change the read status on the smartphone.
Endpoint:
Parameter:
| Parameter | Description |
|---|---|
| apikey | Required The API key you have or will receive. |
| guid_message | Required GUID of the message to mark as read. |
Example:
GET https://api.smsmobileapi.com/getsms/set-read/?apikey=YOUR_APIKEY&guid_message=GUID_MESSAGE
Update SMS alias
This API endpoint is used to update the alias of a received SMS using its GUID.
Note: The alias parameter can be empty. In that case, the alias will be cleared.
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your API key. |
| guid | Required GUID of the received SMS to update. |
| alias | Required Alias to assign to this SMS. This value can be empty to clear the current alias. |
Example:
GET https://api.smsmobileapi.com/getsms/update/?apikey=YOUR_API_KEY&guid=GUID_OF_THE_MESSAGE&alias=John%20Doe
Example to clear the alias:
GET https://api.smsmobileapi.com/getsms/update/?apikey=YOUR_API_KEY&guid=GUID_OF_THE_MESSAGE&alias=
Delete SMS
This endpoint allows you to delete SMS messages from the SMSMobileAPI server log.
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your unique API key. |
| guid_message | Delete a specific message using its unique message GUID. |
| date_start | If used alone, deletes all logged messages from the specified date. |
| date_end | Used together with date_start to delete messages within a date range. |
Example request:
GET https://api.smsmobileapi.com/deletesms/?apikey=YOUR_API_KEY&guid_message=GUID_OF_THE_MESSAGE
Example JSON response:
{
"result": {
"error": null,
"count_delete": 1
}
}
Response explanation:
| Field | Description |
|---|---|
| result.error | null means no error was returned by the API during the deletion request. |
| result.count_delete | Number of SMS log entries deleted from the server. |
Note: only SMS stored in the SMSMobileAPI server logs are deleted. SMS messages already stored on the mobile device are not deleted.
List SMS conversations
This API endpoint is used to list SMS conversations linked to your account.
Each conversation is grouped by phone number and contains the related incoming and outgoing SMS messages.
Note: The conversation starting point is defined by the origineConversation parameter:
- received: conversations are first detected from received SMS in logsmsreceive
- sent: conversations are first detected from sent SMS in logsmssent
Note: If numero is not provided, the API returns the latest conversations only. By default, the last 20 conversations are returned.
Note: For outgoing SMS, if timearea_of_message is available (example: UTC+02), the displayed date is automatically converted using this value. This converted date is also used for sorting.
Note: If resume=1, only the latest messages of each conversation are returned. Use resume_line_how to define how many latest messages should be included.
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your API key. |
| origineConversation | Required Defines the starting point of the conversation listing. Allowed values: received or sent. |
| numero | Optional Filter the result for one specific phone number only. |
| date_from | Optional Start date filter for conversations and messages. Accepted format: YYYY-MM-DD or a full datetime value. |
| date_to | Optional End date filter for conversations and messages. Accepted format: YYYY-MM-DD or a full datetime value. |
| sort | Optional Sort order for conversations. Allowed values: DESC or ASC. Default: DESC. |
| limit | Optional Maximum number of conversations to return when numero is not provided. Default: 20. |
| resume | Optional If set to 1, only the latest messages of each conversation are returned. |
| resume_line_how | Optional Number of latest messages to return per conversation when resume=1. Default: 1. |
Behavior details:
- Incoming SMS are read from logsmsreceive.
- Outgoing SMS are read from logsmssent.
- Incoming messages always return direction = "incoming".
- Outgoing messages always return direction = "outgoing".
- The contact alias is taken from logsmsreceive.alias when available.
- For incoming SMS, the mobile SID comes from sIdentifiant_pour_read.
- For outgoing SMS, the mobile SID comes from send_from_mobile_sIdentifiant.
- For outgoing SMS, the displayed date is adjusted with timearea_of_message if this field is not empty.
Example 1 - List latest conversations from received SMS:
GET https://api.smsmobileapi.com/conversation/sms/list/?apikey=YOUR_API_KEY&origineConversation=received
Example 2 - List latest conversations from sent SMS:
GET https://api.smsmobileapi.com/conversation/sms/list/?apikey=YOUR_API_KEY&origineConversation=sent
Example 3 - Filter one specific phone number:
GET https://api.smsmobileapi.com/conversation/sms/list/?apikey=YOUR_API_KEY&origineConversation=received&numero=%2B32470000001
Example 4 - Filter by date range:
GET https://api.smsmobileapi.com/conversation/sms/list/?apikey=YOUR_API_KEY&origineConversation=received&date_from=2026-03-01&date_to=2026-03-31
Example 5 - Resume mode with the last 3 messages per conversation:
GET https://api.smsmobileapi.com/conversation/sms/list/?apikey=YOUR_API_KEY&origineConversation=sent&resume=1&resume_line_how=3
Successful response example:
{
"success": true,
"origineConversation": "received",
"resume": 0,
"resume_line_how": null,
"conversations": [
{
"phone_number": "+10470000001",
"contact_alias": "John Doe",
"messages": [
{
"direction": "incoming",
"message_id": "msg_1001",
"date": "2026-03-13 08:45:12",
"timestamp_utc": "2026-03-13T08:45:12Z",
"message": "Hello, I would like more information.",
"status": "received",
"mobile_sid": "device_sid_1"
},
{
"direction": "outgoing",
"message_id": "msg_1002",
"date": "2026-03-13 10:46:03",
"timestamp_utc": "2026-03-13T08:46:03Z",
"message": "Of course, what would you like to know?",
"status": "sent",
"mobile_sid": "device_sid_2"
}
]
}
]
}
Response fields:
| Field | Description |
|---|---|
| success | Indicates whether the request was successful. |
| origineConversation | The starting mode used to build the conversation list. |
| resume | Indicates whether resume mode is enabled. |
| resume_line_how | Number of latest lines returned per conversation when resume mode is enabled. |
| conversations | Array of conversations. |
| phone_number | Phone number used to identify the conversation. |
| contact_alias | Alias linked to the phone number when available. |
| messages | Array of SMS messages inside the conversation. |
| direction | incoming for received SMS, outgoing for sent SMS. |
| message_id | Unique identifier of the message. |
| date | Display date of the message. For outgoing SMS, this value can be adjusted using timearea_of_message. |
| timestamp_utc | UTC timestamp of the message. |
| message | Message content. |
| status | received for incoming SMS, sent for outgoing SMS. |
| mobile_sid | SID of the mobile device that received or sent the message. |
Error example:
{
"success": false,
"error": "Missing required parameter: apikey"
}
Notes:
- If numero is provided, the API returns only the conversation linked to this phone number.
- If numero is not provided, the API returns the latest conversations according to the selected origin mode.
- Incoming and outgoing messages are merged into a single timeline for each phone number.
- Outgoing message sorting takes the adjusted local date into account when timearea_of_message is available.
- Resume mode is useful for dashboards, widgets, previews, and conversation summaries.
Gateway – List connected mobiles
List mobiles connected to your SMS Gateway.
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your API key. |
| sid | Filter by exact SID (sIdentifiant_pour_check). |
| search | Search in fields (sid, date, battery, version, label...). |
Example:
GET https://api.smsmobileapi.com/gateway/mobile/list/?apikey=YOUR_API_KEY
Gateway – Update a mobile label
Update the label (nom_reference) of a connected mobile.
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your API key. |
| sid | Required The device SID (sIdentifiant_pour_check). |
| label | New label |
| phone_number | New phone number |
Example:
GET https://api.smsmobileapi.com/gateway/mobile/update/?apikey=YOUR_API_KEY&sid=SID&label=OfficePhone
Important: label is required but can be empty (label=).
Gateway – Delete a connected mobile
Remove a connected mobile from your gateway (deletes all history rows for this SID).
Endpoint:
Parameters:
| Parameter | Description |
|---|---|
| apikey | Required Your API key. |
| sid | Required The device SID (sIdentifiant_pour_check). |
Example:
GET https://api.smsmobileapi.com/gateway/mobile/delete/?apikey=YOUR_API_KEY&sid=SID
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
$payload = file_get_contents('php://input');
$data = json_decode($payload, true);
if ($data) {
file_put_contents('sms_log.txt', print_r($data, true), FILE_APPEND);
http_response_code(200);
echo "Webhook received successfully.";
} else {
http_response_code(400);
echo "Invalid payload.";
}
?>
Testing the Webhook
To test your webhook configuration, use tools like:
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.
Enriched SMS
Coming soonAuthentication
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
This method requires an API Key that can be included as a parameter in either a GET or POST request.
2. OAuth2 Authentication
OAuth2 provides a more secure authentication method.
Use a client ID and client secret to obtain an access token, then include it in the Authorization header.
The client_id and client_secret are available in your dashboard.
Download the mobile app now or
access your dashboard.
Obtaining an Access Token
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=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET"
Using the Access Token:
curl -X POST https://api.smsmobileapi.com/sendsms \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-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.
Send SMS
WSDL URL
Parameters:
- message: The message to send.
- apikey: The API key you have or will receive.
Example
require_once "lib/nusoap.php";
$client = new nusoap_client("https://api.smsmobileapi.com/sendsms/wsdl/sendsms.wsdl", true);
$error = $client->getError();
$result = $client->call("sendSms", array("recipients" =>$_GET['recipients'],"message" =>$_GET['message'],"apikey" =>$_GET['apikey']));
print_r($result);
Send SMS & WhatsApp
Basic cURL Command
curl -X POST https://api.smsmobileapi.com/sendsms/ \
-d "recipients=PHONE_NUMBER" \
-d "message=YOUR_MESSAGE" \
-d "apikey=YOUR_API_KEY"
-d "sendwa=1"
-d "sendsms=1"
Send SMS & WhatsApp
Use our official Python Module : https://smsmobileapi.com/python/
import requests
url = "https://api.smsmobileapi.com/sendsms/"
payload = {"recipients":"PHONE_NUMBER","message":"YOUR_MESSAGE","apikey":"YOUR_API_KEY"}
response = requests.post(url, data=payload)
print(response.text)
SMS Mobile API - PHP SDK (Composer)
composer require smsmobileapi/sdk
GitHub: https://github.com/SmsMobileApi/smsmobileapi-php/tree/main
Send SMS & WhatsApp
const url = "https://api.smsmobileapi.com/sendsms/";
const data = {recipients:"PHONE_NUMBER", message:"YOUR_MESSAGE", apikey:"YOUR_API_KEY"};
fetch(url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(data)})
.then(r=>r.text()).then(console.log);
Send SMS & WhatsApp
const axios = require("axios");
axios.post("https://api.smsmobileapi.com/sendsms/", {recipients:"PHONE_NUMBER", message:"YOUR_MESSAGE", apikey:"YOUR_API_KEY"})
.then(r=>console.log(r.data));
Send SMS & WhatsApp
require "net/http"
require "uri"
uri = URI.parse("https://api.smsmobileapi.com/sendsms/")
req = Net::HTTP::Post.new(uri)
req.set_form_data({"recipients"=>"PHONE_NUMBER","message"=>"YOUR_MESSAGE","apikey"=>"YOUR_API_KEY"})
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true){|http| http.request(req)}
puts res.body

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.


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