Menghapus Templat Pesan
Endpoint ini menghapus templat pesan WhatsApp yang sudah terdaftar dari sistem Meta. Penghapusan bersifat permanen — templat yang telah dihapus tidak dapat dikembalikan.
🛜 Endpoint
DELETE /v1/templates/:name
Parameter :name adalah nama templat yang akan dihapus. Jika nama mengandung karakter khusus, lakukan URL encoding (misalnya spasi menjadi %20).
📋 Parameter
Endpoint ini tidak memerlukan query parameter tambahan. Cukup sertakan nama templat pada path URL dan header Authorization.
🚦 Contoh cURL Request
curl -X DELETE "https://api.kirem.co/v1/templates/promo_diskon_baru" \
-H "Authorization: Bearer kirem_live_xxx"
🚦 Contoh Kode (Node.js)
const axios = require('axios');
const templateName = 'promo_diskon_baru';
const encodedName = encodeURIComponent(templateName);
axios.delete(`https://api.kirem.co/v1/templates/${encodedName}`, {
headers: { 'Authorization': 'Bearer kirem_live_xxx' }
}).then(res => console.log(res.data));
🚦 Contoh Kode (Go)
package main
import (
"fmt"
"net/http"
"net/url"
)
func main() {
templateName := "promo_diskon_baru"
encodedName := url.PathEscape(templateName)
req, _ := http.NewRequest("DELETE",
fmt.Sprintf("https://api.kirem.co/v1/templates/%s", encodedName), nil)
req.Header.Set("Authorization", "Bearer kirem_live_xxx")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println("Status:", resp.Status)
}
🚦 Contoh Kode (PHP)
<?php
$templateName = 'promo_diskon_baru';
$encodedName = urlencode($templateName);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.kirem.co/v1/templates/{$encodedName}");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer kirem_live_xxx']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
✅ Respons Sukses (200 OK)
{
"status": 200,
"message": "Template deleted successfully",
"data": {
"success": true
}
}
⚠️ Peringatan Penting
- Penghapusan bersifat permanen. Templat yang sudah dihapus tidak dapat dikembalikan dan harus dibuat ulang dari awal jika diperlukan kembali.
- Periksa kampanye aktif: Jangan menghapus templat yang sedang digunakan oleh kampanye pengiriman massal atau automasi yang sedang berjalan. Penghapusan dapat menyebabkan kegagalan pengiriman pesan.
- Gunakan endpoint List Templates untuk memeriksa status templat sebelum menghapus.
- Jika nama templat tidak ditemukan, API akan mengembalikan error
404 Not Found.