1. Create Template
Creates a new message template for the authenticated user and queues it for approval.
Endpoint
POST https://wa20.nuke.co.in/webhook/api/createTemplates.php
Authentication
Required. Send a JWT in one of the following ways:
| Method | Example |
|---|---|
| Header | Authorization: Bearer <jwt_token> |
| Cookie | auth_token=<jwt_token> |
The token payload must contain data.name or data.username — this becomes the template owner.
Headers
| Header | Value |
|---|---|
Content-Type | application/json |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
template_name | string | Yes | Unique name for the template (per user). |
category | string | Yes | One of marketing, utility, auth. |
language | integer | No | Language ID (see table below). Defaults to 1 (English (US)) if omitted or invalid. |
header_area_type | string | No | One of media, text, none. Defaults to none. |
header_media_type | string | Conditional | Required when header_area_type is media. One of Image, Document, Video. |
template_body | string | No | Main body text of the template. |
template_footer | string | No | Footer text of the template. |
quick_reply_buttons | array | No | Array of button objects, each { "type": "QUICK_REPLY", "text": "..." }. |
Supported Language IDs
| ID | Language | Short Code |
|---|---|---|
| 1 | English (US) | en_US |
| 2 | Telugu | te |
| 3 | Tamil | ta |
| 4 | Russian | ru |
| 5 | Punjabi | pa |
| 6 | Marathi | mr |
| 7 | Malayalam | ml |
| 8 | Hindi | hi |
| 9 | Gujarati | gu |
| 10 | Urdu | ur |
| 11 | Bengali | bn |
| 12 | Kannada | kn |
| 13 | English (UK) | en_GB |
| 14 | English | en |
| 15 | Hebrew | he |
Pass the numeric
idas thelanguagefield in the request body. If you omit it or pass an invalid ID, it defaults to1(en_US).
Example Request
POST https://wa20.nuke.co.in/webhook/api/createTemplates.php
Authorization: Bearer eyJhbGciOi...
Content-Type: application/json
{
"template_name": "order_confirmation",
"category": "utility",
"language": 1,
"header_area_type": "text",
"template_body": "Hi {{1}}, your order #{{2}} has been confirmed.",
"template_footer": "Thank you for shopping with us.",
"quick_reply_buttons": [
{ "type": "QUICK_REPLY", "text": "Track Order" },
{ "type": "QUICK_REPLY", "text": "Contact Support" }
]
}
cURL Example
curl -X POST "https://wa20.nuke.co.in/webhook/api/createTemplates.php" \
-H "Authorization: Bearer eyJhbGciOi..." \
-H "Content-Type: application/json" \
-d '{
"template_name": "order_confirmation",
"category": "utility",
"language": 1,
"header_area_type": "text",
"template_body": "Hi {{1}}, your order #{{2}} has been confirmed.",
"template_footer": "Thank you for shopping with us.",
"quick_reply_buttons": [
{ "type": "QUICK_REPLY", "text": "Track Order" },
{ "type": "QUICK_REPLY", "text": "Contact Support" }
]
}'
Example Response — 200 OK
{
"success": true,
"message": "Template created successfully",
"username": "shubham",
"template_id": 214,
"template_controller_id": 214,
"status": 3,
"controller_status": "pending",
"language_id": 1,
"language": "English (US)"
}
Error Responses
| Status | Message | Reason |
|---|---|---|
| 405 | Method not allowed | Request method is not POST. |
| 401 | Invalid Authorization token | Missing or unparseable JWT / no username claim. |
| 400 | template_name is required | template_name missing or empty. |
| 400 | category must be marketing, utility, or auth | Invalid category value. |
| 400 | header_area_type must be media, text, or none | Invalid header_area_type value. |
| 400 | header_media_type must be Image, Document, or Video when header_area_type is media | Missing/invalid header_media_type for a media header. |
| 400 | quick_reply_buttons must be an array | quick_reply_buttons not an array. |
| 400 | Each quick reply button must contain type=QUICK_REPLY and a non-empty text | Malformed button object. |
| 409 | This template name is already exist | A template with this name already exists for the user. |
| 500 | Database connection failed / insert errors | Server/database error. |
Notes
- New templates are always created with
status = 3(pending review). - A matching row is also created in the internal template controller/queue, with
typeset tocustom,customutility, orcustomauthdepending oncategory.
2. Get Templates by Username
Returns all templates belonging to a given username.
Endpoint
GET https://wa20.nuke.co.in/webhook/api/templates.php?username={username}
Authentication
None enforced at this endpoint — access is controlled purely by the username query parameter, so treat it as an internal/admin endpoint rather than a client-facing one until authentication is added.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
username | string | Yes | Username to fetch templates for. |
Example Request
GET https://wa20.nuke.co.in/webhook/api/templates.php?username=username
cURL Example
curl -X GET "https://wa20.nuke.co.in/webhook/api/templates.php?username=username"
Example Response — 200 OK
[
{
"id": 214,
"username": "shubham",
"template_name": "order_confirmation",
"status": 3,
"category": 2,
"language": 1,
"header_area_type": "text",
"header_media_type": "",
"template_body": "Hi {{1}}, your order #{{2}} has been confirmed.",
"template_footer": "Thank you for shopping with us.",
"quick_replies": "[{\"type\":\"QUICK_REPLY\",\"text\":\"Track Order\"}]",
"created_at": "2026-07-11 10:15:32"
}
]
Error Responses
| Status | Message | Reason |
|---|---|---|
| 400 | username is required | Missing or empty username parameter. |
| 404 | Template not found for this username | No templates exist for this username. |
| 500 | Database connection failed / Failed to prepare query | Server/database error. |
