إرسال
SMS

Send Template SMS

Send an SMS using a pre-defined message template with dynamic variables

Endpoint

POST /api/sms/messages/template

Request body

FieldTypeRequiredDescription
template_idstringYesThe short name/ID of the template to use
senderstringYesSender ID (max 11 alphanumeric chars)
payment_typestringYeswallet or subscription
receiverstringYesPhone number in international format
paramsarrayYesArray 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
}
FieldDescription
message_idUnique identifier for the sent message
costNumber 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.

On this page