Get a WhatsApp Template Status

GET Method

Kaleyra.io offers an API that enables you to get the current WhatsApp template status for a name-specific template OR you can get the current WhatsApp templates status for all the templates associated with your SID. Also, this API provides additional information such as the header details, the body of the template, the footer details, and the button details of the WhatsApp template.

You can retrieve the information about status either using callback or using this API. To know more about the callback, see Template Status Update Callback.

You can view the following WhatsApp statuses:

  • Approved - For the approved WhatsApp template.
  • Rejected - For the rejected WhatsApp template.
  • Pending - For the pending WhatsApp template.
  • Submission Rejected - When Meta does not accept the WhatsApp template request from Kaleyra because it does not fulfill the criteria defined by them.
  • Paused - The template has been paused due to recurring negative feedback from customers. Message templates with this status cannot be sent to customers.
  • Disabled - The template has been disabled due to recurring negative feedback from customers. Message templates with this status cannot be sent to customers.

πŸ“˜

Note:

When a message template quality reaches a low rating, it is automatically paused for a period of time to protect the quality rating of phone numbers using the template.

Pausing durations are listed as follows:

  • 1st Instance: Paused for 3 hours
  • 2nd Instance: Paused for 6 hours
  • 3rd Instance: Disabled

Base URL

https://api.kaleyra.io/v1/<SID>

To get the WhatsApp template status and related entities, perform the following:

Signup or Login to Kaleyra.io and Create your API key

Refer to the Create an API Key page for steps to create your API key. To view the API Key and the SID, see View API Key and SID.

πŸ“˜

Note:

After you sign up, your account will be on the trial version. You must complete the KYC to access all the features in Kaleyra.io.

API Request to get WhatsApp Template Status

To get the WhatsApp template status, use the endpoints with the following request method:

Request format to get the WhatsApp template's header, body of the template, footer, and button details

curl --location '{{url}}/v1/{{SID}}/whatsapp/templates/details?name={{NAME}}&status={{STATUS}}&waba_id={{WABA_ID}}&category={{CATEGORY}}&limit={{LIMIT}}&offset={{OFFSET}}' \
--header 'api-key: {{API_KEY}}'

Request Format for a name-specific template status

curl --location --request GET '{{url}}/v1/{{SID}}/whatsapp/templates/status?name={{TEMPLATE_NAME}}' \ 
--header 'api-key: {{API_KEY}}'

Request Format for all the templates statutes based on SID

curl --location --request GET '{{url}}/v1/{{SID}}/whatsapp/templates/status' \ 
--header 'api-key: {{API_KEY}}'

πŸ“˜

Note:

If you want to get the status (template name, template status, and date of template creation) of all the WhatsApp templates associated with your SID remove the ?name={{TEMPLATE_NAME}} endpoint and send the request. For a successful response, you will get the response with all the WhatsApp template statuses.

The following table displays the parameter used to get WhatsApp template status API:

ParameterData TypeDescriptionExampleMandatory
sidStringAccount SID (Security Identifier).HXXXXXXX071USYes
nameStringTemplate name for which you want to know the WhatsApp template statuses. If you have multiple names, use a comma (,) between them.BXXBXXD_SaleYes (For a name-specific template) else No
api-keyStringAPI key generated from Kaleyra.io account.Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3Yes
waba_idIntegerWhatsApp Business Account ID. If you have multiple WABA IDs, use a comma (,) between them.1122397XXXXXXXXNo (Optional)
statusStringFilter the API based on the status of the WhatsApp templates.
For example, Approved, Rejected, Pending, and many more. If you have multiple statuses, use a comma (,) between them.
ApprovedNo (Optional)
categoryStringFilter API based on categories of the templates. For example, Authentication, Utility, or Marketing. If you have multiple categories, use a comma (,) between them.MarketingNo (Optional)
limitIntegerFilter based on a number of API request that has to be filtered in an API request. The default limit value is 25.
The maximum limit value is 75.
25No (Optional)
offsetIntegerWhatsApp templates to escape and view the remaining WhatsApp templates. The default is 0. Based on the example input, that is 5, the first 5 WhatsApp templates will be escaped from the WhatsApp template list.5No (Optional)

Sample Request Method

Sample request for template's header, body of the template, footer, and button details

The following sample is the request method to get the WhatsApp template's header, body of the template, footer, and button details:

curl --location 'https://api.kaleyra.io/v1/HXXXXXXX071US/whatsapp/templates/details?name=hello12345&status=rejected%2Capproved&waba_id=1122397XXXXXXXX&category=utility%2Cmarketin&limit=5&offset=1' \
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3'

Sample Request for a name-specific template status

The following sample is the request method to get WhatsApp template status using name-specific:

curl --location --request GET 'https://api.kaleyra.io/v1/HXXXXXXX071US/whatsapp/templates/status?name={{BXXBXXD_Sale}}' \ 
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3'

Sample Request for all the templates statutes based on SID

The following sample is the request method to get WhatsApp template statuses based on SID:

curl --location --request GET 'https://api.kaleyra.io/v1/HXXXXXXX071US/whatsapp/templates/status' \ 
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3'

Sample Success Response

Sample success response for template's header, body of the template, footer, and button details

You can view the template's header, body of the template, footer, and button details. The following success message appears with status 200 when the requested entities match with the available WhatsApp templates.

{
    "code": "WA200",
    "message": "Request Processed Successfully",
    "data": [
        {
            "name": "Name1",
            "components": [
                {
                    "type": "HEADER",
                    "format": "Text",
                    "text": "testing header content {{$1}}"
                },
                {
                    "type": "BODY",
                    "text": "hello testing body {{$1}} {{$2}}"
                },
                {
                    "type": "BUTTON",
                    "buttons": [
                        {
                            "type": "URL",
                            "text": "avi",
                            "url": "https://klr.az/"
                        }
                    ]
                }
            ],
            "language": "en",
            "status": "Submission Rejected",
            "category": "Marketing",
            "waba_id": "1222397XXXXXXXX"
        },
        {
            "name": "Name2",
            "components": [
                {
                    "type": "HEADER",
                    "format": "None"
                },
                {
                    "type": "BODY",
                    "text": "This is a template"
                }
            ],
            "language": "en",
            "status": "Pending",
            "category": "Marketing",
            "waba_id": ""
        },
        {
            "name": "Name3",
            "components": [
                {
                    "type": "HEADER",
                    "format": "Text",
                    "text": "Hello {{$1}}"
                },
                {
                    "type": "BODY",
                    "text": "Your Order is being Picked up."
                },
                {
                    "type": "BUTTON",
                    "buttons": [
                        {
                            "type": "URL",
                            "text": "PLAY NOW",
                            "url": "https://klr.bz/"
                        }
                    ]
                }
            ],
            "language": "en",
            "status": "Approved",
            "previous_category": "Alert Update",
            "category": "Marketing",
            "waba_id": "1122397XXXXXXXX"
        },
        {
            "name": "Name4",
            "components": [
                {
                    "type": "HEADER",
                    "format": "Text",
                    "text": "testing header content {{$1}}"
                },
                {
                    "type": "BODY",
                    "text": "hello testing body {{$1}} {{$2}}"
                },
                {
                    "type": "BUTTON",
                    "buttons": [
                        {
                            "type": "URL",
                            "text": "avi",
                            "url": "https://klr.cz/"
                        }
                    ]
                }
            ],
            "language": "en",
            "status": "Submission Rejected",
            "category": "Marketing",
            "waba_id": "1222397XXXXXXXX"
        },
        {
            "name": "Name5",
            "components": [
                {
                    "type": "HEADER",
                    "format": "Text",
                    "text": "testing header content {{$1}}"
                },
                {
                    "type": "BODY",
                    "text": "hello testing body {{$1}} {{$2}}"
                },
                {
                    "type": "BUTTON",
                    "buttons": [
                        {
                            "type": "URL",
                            "text": "avi",
                            "url": "https://klr.dz/"
                        }
                    ]
                }
            ],
            "language": "en",
            "status": "Submission Rejected",
            "category": "Marketing",
            "waba_id": "1222397XXXXXXXX"
        }
    ],
    "error": {},
    "limit": 5,
    "offset": 5,
    "total": 28
}

The following success message appears with status 200 when the requested entities do not match with the available WhatsApp templates:

{
    "code": "WA200",
    "message": "Request Processed Successfully",
    "data": [],
    "error": {},
    "limit": 1,
    "offset": 1
}

Sample success response for a name-specific template

The following success message appears with status 200, you can view the template name, template status, and date of template creation:

{
    "code": "200",
    "message": "Request successfully executed!",
    "data": {
        "name": "BXXBXXD_Sale",
        "status": {
            "id": "1",
            "name": "Approved"
        },
        "created_at": "1675182226"
    },
    "error": [],
    "total": 1,
    "limit": 25,
    "offset": 0
}

Sample success response for all the templates statutes based on SID

The following success message appears with status 200, you can view the template name, template status, and date of template creation:

{
    "code": "200",
    "message": "Request successfully executed!",
    "data": [
        {
            "name": "BXXBXXD_Sale",
            "status": {
                "id": "1",
                "name": "Approved"
            },
            "created_at": "1675182226"
        },
        {
            "name": "Template2",
            "status": {
                "id": "1",
                "name": "Rejected"
            },
            "created_at": "1674650304"
        },
        {
            "name": "Template3",
            "status": {
                "id": "1",
                "name": "Pending"
            },
            "created_at": "1674650154"
        },
        {
            "name": "Template4",
            "status": {
                "id": "1",
                "name": "Submission Rejected"
            },
            "created_at": "1665230132"
        },

        {
            "name": "Template4",
            "status": {
                "id": "9",
                "name": "Approved"
            },
            "created_at": "1660900841"
        }
    ],
    "error": [],
    "total": 4,
    "limit": 25,
    "offset": 0
}

Error Codes

For information related to the WhatsApp error code, see WhatsApp Error Codes.