Delete Template

Delete Method

The Delete Template API allows you to delete a WhatsApp template by name or its template ID.

📘

Note:

  • Deleting a template by name deletes all templates that match that name (meaning templates with the same name but different languages will also be deleted).
  • To delete a template by ID, include the template's ID along with its name in your request; only the template with the matching template ID will be deleted.

Prerequisites

  1. Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID.
    A prerequisite for using Kaleyra WhatsApp APIs is to have an active WhatsApp plan on kaleyra platform.
  2. To set up a WhatsApp account on kaleyra.io, see Manual Signup
    and Embedded Signup.
  3. An active WhatsApp for Business API plan that includes:
    • A WhatsApp business number.
    • An associated profile with the business number.
    • A WhatsApp verified and approved profile.

Base URL

https://<api_domain>/v2/<SID>

API Domain and Value

api_domainValue
IN podapi.in.kaleyra.io
SG Podapi.ap.kaleyra.io
EU Podapi.eu.kaleyra.io

API request to delete the whatsapp template

To delete the whatsapp template, use the https://<api_domain>/v2/<sid>/whatsapp/<waba_id>/message_templates endpoint with the following request method:

Request Format

The following is the request format to delete whatsapp template:

curl -L -X DELETE \
  `https://<api_domain>/v2/<sid>/whatsapp/<waba_id>/message_templates?name=<template_name>&template_id=<template_id>` \
  -H `api-key: <api-key>` \
  -H `cache-control: no-cache`

Sample Request Format

The following is the sample request format to delete whatsapp template:

curl -L -X DELETE \
  `https://<api_domain>/v2/HXAP16XXXXXX97IN/whatsapp/150XXXXXX142241/message_templates?name=order_ confirmation&template_id=120XXXXXXXXX241` \
  -H `api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3` \
  -H `cache-control: no-cache`

URL Parameters and Headers

Following is the list of parameters and headers to send the outgoing message request:


Parameter / HeadersData TypeDescriptionExampleMandatory?
sidStringAccount SID (Security Identifier).HXAP16XXXXXX97INYes
waba_idStringWhatsApp Business Account. For more information see, Adding a new WABA ID.150XXXXXX142241Yes
template_nameStringSpecifies the template name.
Note: The template_name must be approved by WhatsApp before you start using this API.
order_confirmationYes
template_idStringSpecifies the template ID. 120XXXXXXXXX241No
api-keyStringAPI key generated from Kaleyra platform account.Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx3Yes

Sample Success Response

The following success message appears with the status 202 Accepted:

{
    "code": "WA200",
    "message": "Request Processed Successfully",
    "data": {
        "success": true
    },
    "error": {}
}

Sample Failure Response

The following are the failure responses:

401 Unauthorized
{
    "code": "RBC001",
    "message": "Incorrect SID or API key.",
    "data": [],
    "error": {
        "error": "Incorrect SID or API key."
    }
}
401 Wrong account
{
    "code": "WA-401",
    "message": "API is not available for given customer.Please contact support for more info",
    "data": {},
    "error": "API is not available for given customer.Please contact support for more info"
}
401 Unauthorized WABA
{
    "code": "WA401",
    "message": "Waba_Id is not present or does not belong to the account.",
    "data": {},
    "error": {
        "waba_id": "Waba_Id is not present or does not belong to the account."
    }
}
401 Unauthorized WABA version
{
    "code": "WA401",
    "message": "The waba_id you're using is associated with different Version of our WA API. Please use the appropriate endpoint.",
    "data": {},
    "error": {
        "waba_id": "The waba_id you're using is associated with different Version of our WA API. Please use the appropriate endpoint."
    }
}
400 Incorrect payload
{
    "code": "WA-400",
    "message": "Refer to correct payload format",
    "data": {},
    "error": {
        "payload": "Incorrect payload format"
    }
}
500 Internal Server Error
{
    "code": "WA-500",
    "message": "Please try again later",
    "data": {},
    "error": {
        "error": "Internal server error"
    }
}
429 Too many requests
{
    "code": "WA429",
    "message": "Too many requests",
    "data": {},
    "error": {
        "error": "Too many requests sent from this waba in a short period of time, please try after sometime"
    }
}
Meta Error
{
    "code": "WA400",
    "message": "error returned from meta",
    "data": {},
    "error": {
        "code": 100,
        "error_subcode": 2593048,
        "error_user_msg": "Make sure that the HSM name and ID match.",
        "error_user_title": "Name and ID do not match",
        "fbtrace_id": "AI4yYl-mIsrlsb7rmO3HY0R",
        "is_transient": false,
        "message": "Invalid parameter",
        "type": "OAuthException"
    }
}