PUT /api/templates/{id}
Update an existing template. Use this endpoint to change the status from draft to approved, update the variable schema, or modify other template properties.
Path parameters
Request body
New status: draft, approved, or archived.
Template availability setting.
Display order sequence number.
Updated template-level configuration.
Updated variable declarations. Each key is a variable name with a type of string, image, or action.
Example request
curl -X PUT https://{appId}.api-{region}.cometchat.io/v3/business-messaging/api/templates/665b2c3d4e5f6a7b8c9d0e1f \
-H "appid: YOUR_APP_ID" \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"status": "approved",
"variableSchema": {
"customerName": { "type": "string" },
"orderId": { "type": "string" },
"trackingUrl": { "type": "action" }
}
}'
Example response
{
"id": "665b2c3d4e5f6a7b8c9d0e1f",
"appId": "YOUR_APP_ID",
"name": "Order Confirmation",
"templateId": "order-confirmation",
"status": "approved",
"category": "transactional",
"channelIds": ["664a1b2c3d4e5f6a7b8c9d0e"],
"variableSchema": {
"customerName": { "type": "string" },
"orderId": { "type": "string" },
"trackingUrl": { "type": "action" }
},
"config": {},
"createdAt": "2024-01-15T09:30:00.000Z",
"updatedAt": "2024-01-16T10:00:00.000Z"
}
To approve a template for sending, set "status": "approved". To retire it, set "status": "archived".