Templates
API for viewing and managing approved WhatsApp templates
Reading time: 2 minutes
Templates
View and manage approved WhatsApp templates from Meta.
Get Templates List
GET
{{base_url}}/templatesView all available WhatsApp templates with search support.
Query Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
page | integer | No | Page number | 1 |
limit | integer | No | Number of results per page | 100 |
searchTerm | string | No | Search in template names | - |
Example Request
Example Requestbash
curl -X GET "https://api.awalchat.com/api/developer/templates?page=1&limit=100&searchTerm=welcome" \
-H "Accept: application/json" \
-H "X-Awal-Signature-256: sha256=abc..." \
-H "X-Timestamp: 1704124800" \
-H "X-Domain: your-workspace" \
-H "X-Client-ID: your-client-id"Example Response
Response200 OK
{
"status": true,
"data": [
{
"id": 1,
"name": "welcome_message",
"language": "en",
"status": "APPROVED",
"category": "UTILITY",
"components": [
{
"type": "BODY",
"text": "Hello {{1}}, thanks for joining!"
}
]
},
{
"id": 2,
"name": "order_confirmation",
"language": "en",
"status": "APPROVED",
"category": "MARKETING",
"components": [
{
"type": "HEADER",
"format": "IMAGE"
},
{
"type": "BODY",
"text": "Your order #{{1}} has been confirmed"
}
]
}
],
"meta": {
"current_page": 1,
"per_page": 100,
"total": 25,
"last_page": 1
}
}Tip: Use searchTerm for quick search in template names.
Get Template by ID
GET
{{base_url}}/templates/{id}View details of a specific template with all components.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | integer | Yes | Template ID |
Example Request
Example Requestbash
curl -X GET "https://api.awalchat.com/api/developer/templates/1" \
-H "Accept: application/json" \
-H "X-Awal-Signature-256: sha256=abc..." \
-H "X-Timestamp: 1704124800" \
-H "X-Domain: your-workspace" \
-H "X-Client-ID: your-client-id"Example Response
Response200 OK
{
"status": true,
"data": {
"id": 1,
"name": "welcome_message",
"language": "en",
"status": "APPROVED",
"category": "UTILITY",
"components": [
{
"type": "HEADER",
"format": "TEXT",
"text": "Welcome!"
},
{
"type": "BODY",
"text": "Hello {{1}}, thanks for joining {{2}}!",
"example": {
"body_text": [
["Ahmed", "our service"]
]
}
},
{
"type": "BUTTONS",
"buttons": [
{
"type": "QUICK_REPLY",
"text": "Get Started"
}
]
}
],
"created_at": "2024-01-10T10:00:00Z",
"updated_at": "2024-01-15T14:30:00Z"
}
}Important Notes
š”
Template Status
APPROVED- Approved and can be usedPENDING- Under review by MetaREJECTED- Rejected (check rejection reason)
ā ļø
Using Templates
- Template must be approved before use
- Pending or rejected templates cannot be used
- See Send WhatsApp Template for usage details
ā
Template Categories
UTILITY- Utility templates (confirmations, notifications)MARKETING- Marketing templates (offers, advertisements)AUTHENTICATION- Authentication templates (verification codes)
Use Cases
1. Search for Specific Template
GET /templates?searchTerm=welcome&phone_number_id=1234562. View Approved Templates Only
const templates = await getTemplates();
const approved = templates.data.filter(t => t.status === 'APPROVED');3. Use Template in Message
See Send WhatsApp Template for complete details.
Error Codes
| Code | Description | Cause | Solution |
|---|---|---|---|
| 404 | Not Found | Template not found | Check template ID |
| 400 | Bad Request | Invalid data | Check sent data |
Related Sections
Technical Support
Need help?
- š§ Email: support@awalchat.com
- š¬ Live Chat: Available in the dashboard
- š± WhatsApp: Contact us directly via WhatsApp
- š Examples: Check Code Examples