Delete a WhatsApp template
curl --request DELETE \
--url https://app.kapso.ai/api/v1/whatsapp_templates/{template_id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-API-Key': '<api-key>'}};
fetch('https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "template-123abc",
"name": "old_promotion",
"language_code": "en_US",
"category": "MARKETING",
"status": "removed",
"business_account_id": "123456789012345",
"created_at": "2024-01-10T10:00:00Z",
"updated_at": "2024-01-15T14:30:00Z"
}
}WhatsApp Templates
Delete a WhatsApp template
Deletes a WhatsApp template from both the local database and WhatsApp’s servers.
Behavior:
- If template is already marked as removed, returns the template without making API calls
- Otherwise, deletes the template from WhatsApp API first, then marks it as removed locally
- Requires a production WhatsApp configuration associated with the template’s Business Account
Note: This operation marks the template as removed rather than completely deleting it from the database.
DELETE
/
whatsapp_templates
/
{template_id}
Delete a WhatsApp template
curl --request DELETE \
--url https://app.kapso.ai/api/v1/whatsapp_templates/{template_id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-API-Key': '<api-key>'}};
fetch('https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.kapso.ai/api/v1/whatsapp_templates/{template_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "template-123abc",
"name": "old_promotion",
"language_code": "en_US",
"category": "MARKETING",
"status": "removed",
"business_account_id": "123456789012345",
"created_at": "2024-01-10T10:00:00Z",
"updated_at": "2024-01-15T14:30:00Z"
}
}
