Send SMS API
Send SMS API
Send an SMS message to a customer phone number via a simple HTTP request. The API supports two modes: sending a raw message you compose yourself, or using a pre-configured SMS template stored in the system.
Endpoint
GET /api/send_sms.php
Authentication
Pass your worker ID via the user_id parameter. The API uses it to look up the customer record and to log the outgoing message against your account.
Mode 1 — Raw Message
Send a message you write directly in the request.
Required Parameters
| Parameter | Type | Description |
|---|---|---|
source_number |
string | The sender name or number shown to the recipient. Alphanumeric only, max 12 characters. |
message |
string | The message text to send. Max 500 characters. |
phone |
string | Recipient's Israeli mobile number in 05X-XXXXXXX or 05XXXXXXXX format.
|
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
user_id |
integer | Your worker ID. Used for customer lookup and logging. |
from_phone |
string | Alternative to phone. Used if phone is not provided.
|
date |
string | Scheduled send date in YYYY-MM-DD format. Defaults to today.
|
time |
string | Scheduled send time in HH:MM:SS format. Defaults to now.
|
repository_assign_id |
integer | If you already know the customer's assignment ID, pass it here to skip the lookup step. |
Example Request
GET /api/send_sms.php
?source_number=MindCRM
&message=Hello, your appointment is confirmed.
&phone=0501234567
&user_id=42
Scheduled Send Example
GET /api/send_sms.php
?source_number=MindCRM
&message=Reminder: your meeting is tomorrow at 10:00.
&phone=0501234567
&user_id=42
&date=2025-07-01
&time=09:00:00
Mode 2 — SMS Template
Use a pre-built template stored in the system. The template text is fetched automatically, and any placeholder variables (such as the customer's name or phone number) are replaced with real data before sending.
Any parameter you pass explicitly overrides the value from the template.
Required Parameters
| Parameter | Type | Description |
|---|---|---|
sms_template_id |
integer | The ID of the SMS template to use. |
phone |
string | Recipient's Israeli mobile number in 05X-XXXXXXX or 05XXXXXXXX format.
|
Optional Parameters
| Parameter | Type | Description |
|---|---|---|
user_id |
integer | Your worker ID. Used for customer data lookup and variable substitution. |
from_phone |
string | Alternative to phone. Used if phone is not provided.
|
source_number |
string | Overrides the template's sender name/number. |
message |
string | Overrides the template's message text entirely. |
date |
string | Scheduled send date in YYYY-MM-DD format. Defaults to now.
|
time |
string | Scheduled send time in HH:MM:SS format. Defaults to now.
|
repository_assign_id |
integer | If you already know the customer's assignment ID, pass it here to skip the lookup step. |
Example Request
GET /api/send_sms.php
?sms_template_id=7
&phone=0501234567
&user_id=42
Override Template Sender Example
GET /api/send_sms.php
?sms_template_id=7
&phone=0501234567
&user_id=42
&source_number=MyBrand
Phone Number Format
The recipient phone number must be an Israeli mobile number matching one of these formats:
0501234567— 10 digits, no separator050-1234567— with a dash separator
Valid prefixes: 050, 051, 052, 053, 054, 055, 058, 059
Response Format
All responses are returned as JSON.
{
"stat_code": 0,
"description": "SMS sent successfully",
"data": "SMS sent successfully"
}
| Field | Type | Description |
|---|---|---|
stat_code |
integer | 0 = success. Any other value = error (see table below).
|
description |
string | Human-readable result message. |
data |
string | Same as description.
|
Error Codes
| Code | Meaning | How to Fix |
|---|---|---|
0 |
Success | — |
1 |
Missing mandatory parameter | Check that all required parameters are included in your request. |
2 |
Invalid phone number format | Ensure the phone number starts with 05 and contains exactly 10 digits.
|
3 |
Message too long | Keep the message under 500 characters. |
4 |
Invalid source_number |
Use only letters and numbers, max 12 characters. No special characters. |
5 |
SMS template not found | Verify the sms_template_id exists and is active in the system.
|
Priority Rules (Mode 2)
When both a template and explicit parameters are provided, explicit parameters always win:
| Value | Source |
|---|---|
message |
Explicit param → Template text (with variables replaced) |
source_number |
Explicit param → Template's source number |
Notes
- Messages are logged automatically in the customer's SMS history.
- Scheduled messages (using
date/time) that are set in the past are sent immediately. - Template variables are replaced with live customer data at the time of the request.