Overview
Send SMS messages using pre-defined templates with dynamic parameters. Templates allow you to create reusable message formats with placeholders that can be filled with specific values for each recipient.Endpoint
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | ✅ | The short name/ID of the template to use |
sender | string | ✅ | The sender ID (up to 11 characters) |
payment_type | string | ✅ | Payment method: wallet or subscription |
receiver | string | ✅ | The recipient’s phone number in international format |
params | array | ✅ | Array of objects mapping placeholder names to values |
Parameter Details
template_id
template_id
The unique identifier of the template you want to use.
- Format: String identifier created when template was defined
- Examples:
welcome_template_123,otp_verification,order_confirmation - Management: Templates are managed through your dashboard
sender
sender
The sender ID that will appear on the recipient’s device.
- Length: Maximum 11 characters
- Format: Alphanumeric characters only
- Examples:
Lamah,MyCompany,Alert123
payment_type
payment_type
Specifies how the SMS cost will be charged.
wallet: Deduct from your account balancesubscription: Use your subscription plan credits
receiver
receiver
The recipient’s phone number in international format.
- Format: Must include country code (e.g.,
+218912345678or00218912345678) - Validation: Number will be validated before sending
params
params
Array of objects to replace named placeholders in the template.
- Format:
[{ "name": "..." }, { "date": "..." }] - Placeholders: Use
{{name}},{{date}}style in templates - Type: All values are strings
- Required: Must include all placeholders present in the template
Template Format
Templates use named placeholders with double curly braces:Example Template
With Parameters
Resulting Message
Response
Success Response (200 OK)
Response Fields
| Field | Type | Description |
|---|---|---|
message_id | string | Unique identifier for the sent message |
message_id | string | Unique identifier for the sent message |
cost | number | Number of SMS parts charged for this send |
Error Responses
400 Bad Request - Invalid Template
400 Bad Request - Parameter Mismatch
401 Unauthorized
402 Payment Required
Template Management
Templates are created and managed through your Lamah dashboard. You cannot create templates via the API.
Creating Templates
- Log into Dashboard: Visit https://sms.lamah.com
- Navigate to Templates: Go to the Templates section
- Create New Template: Click “Create Template”
- Define Content: Write your message with placeholders like
{1},{2}, etc. - Save Template: Give it a unique ID and save
Template Best Practices
Use Clear Placeholders
Use numbered placeholders
{1}, {2} in logical orderKeep It Concise
Templates should be concise to minimize SMS costs
Test Thoroughly
Test templates with various parameter combinations
Document Parameters
Document what each parameter represents for your team