SMS
Send Template SMS
Send an SMS using a pre-defined message template with dynamic variables
Endpoint
POST /api/sms/messages/templateRequest body
| Field | Type | Required | Description |
|---|---|---|---|
template_id | string | Yes | The short name/ID of the template to use |
sender | string | Yes | Sender ID (max 11 alphanumeric chars) |
payment_type | string | Yes | wallet or subscription |
receiver | string | Yes | Phone number in international format |
params | array | Yes | Array of single-key objects mapping placeholder names to values |
Template format
Templates use named placeholders with double curly braces: {{name}}, {{date}}, etc.
Example template
مرحباً {{name}}، تم تأكيد معاينتك للعقار يوم {{date}} الساعة {{time}} في منطقة {{area}}.Params format
params is an array of single-key objects, one per placeholder:
[
{ "name": "أحمد محمد" },
{ "date": "2024-01-15" },
{ "time": "17:00" },
{ "area": "قرقارش" }
]Example
curl -X POST https://sms.lamah.com/api/sms/messages/template \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"template_id": "property_viewing",
"sender": "RealEstate",
"payment_type": "wallet",
"receiver": "00218912345678",
"params": [
{ "name": "أحمد محمد" },
{ "date": "2024-01-15" },
{ "time": "17:00" },
{ "area": "قرقارش" }
]
}'Response
{
"message_id": "msg_123456789",
"cost": 1
}| Field | Description |
|---|---|
message_id | Unique identifier for the sent message |
cost | Number of SMS parts charged for this send |
Error responses
400 Bad Request — Template not found
{ "message": "Template not found" }400 Bad Request — Missing parameter
{ "message": "Missing parameter: name" }401 Unauthorized
{ "message": "Unauthenticated." }Templates are created and managed through your dashboard under Messages → Templates. You cannot create templates via the API.
Managing templates
Create and manage your templates from the dashboard under Messages → Templates.