fbpx

< / >

APIs WhatsApp

10. Edit template

https://wv{{wolkvox_server}}.wolkvox.com/api/v2/whatsapp.php?api=edit_template

Description

This API allows users to edit the information of WhatsApp message templates that have already been created and associated with a specific connector. This functionality is essential for keeping templates up to date, correcting errors, or adjusting content without the need to create a new template from scratch.

Benefits:

  • Flexibility and Agility: Enables businesses to quickly adapt their WhatsApp messages to new promotions, information changes, or policy updates without having to wait for approval of entirely new templates.
  • Ongoing Optimization: Facilitates A/B testing of different content or calls to action within existing templates to improve communication performance.
  • Brand Consistency: Maintains brand consistency by allowing updates to the wording, headers, or footers of existing templates.
  • Time and Resource Saving: Avoids the process of creating and approving an entirely new template for minor changes, optimizing the team’s time.
  • Compliance with Meta Requirements: While changes still require a new review, this process is more efficient than creating a brand-new template.

 
How it works: 
  • This API is consumed using the PUT method.
  • To use this API, you must replace {{wolkvox_server}} in the URL with the naming convention of your operation’s server.
  • The wolkvox-token header must be used to authorize the request.
  • The same token cannot be used simultaneously, so it is recommended to program the next API call to run only after the previous one has successfully completed.
  • Record download limit per request: 60,000 records.
  • Record upload limit per request: 10,000 records.
  • Date range query limit: 31 days.
  • Response payload size limit: 256 MB.
  • API execution time limit: 60 seconds.
  • Concurrent request limit per token: 2 simultaneous requests.
  • Daily token usage limit: Number of licenses multiplied by 1,000 tokens per day.

Code Examples:

In our Postman workspace ([click here] to access it), you have access to code examples that facilitate integration with our APIs in different programming languages such as cURL, Python, JavaScript, and more.

This feature is ideal for quick integrations and allows you to adapt the API calls to your system’s programming language.

How to Use the Code Examples:

  1. Navigate to our Postman workspace.
  2. Select the API you want to consult.
  3. Edit the necessary API parameters according to your goals.
  4. In the “Code” tab, select your preferred programming language.
  5. You will get an auto-generated code snippet, ready to use with the parameters and authentication previously configured.

Request

NAMEDESCRIPTIONTYPE
connector_idThe ID of the WhatsApp connector to which the template to be edited belongs (e.g., “1266”).String
nameThe exact name of the existing template you wish to modify. This field is crucial to identify the template to be edited.String
componentsAn array of objects that define the updated sections of the template. Each object within this array represents a section (e.g., HEADER, BODY, FOOTER, BUTTONS) and its properties. All components that will make up the updated version of the template must be included, even if some remain unchanged, to ensure the template is fully replaced with the new definition.String
type“HEADER”String
formatThe format of the header (e.g., “TEXT”, “IMAGE”, “VIDEO”, “DOCUMENT”).Array
textThe header text (if format is “TEXT”). It can contain variables.String
formatThe type of media file. It can be “IMAGE”, “VIDEO”, or “DOCUMENT”.String
exampleObject used to provide variable examples.Object
header_textAn array with a nested array containing the sample value for the variable in the header text.String
typeBODY component.String
textThe main content of the message. It can include dynamic variables (e.g., {{1}}, {{2}}, {{3}}).String
exampleObject containing body_text.Object
body_textRequired. An array of arrays with sample texts for the variables defined in text. These examples are for Meta’s review purposes only and will not be sent to the end user. (e.g., [[“Example Name”, “Example Name 2”]]).String
typeFOOTER component.String
textThe text to be displayed in the template footer. (e.g., “Use the buttons below to manage your marketing subscriptions”).String
typeBUTTONS component. Defines an individual button and its properties.String
buttonsArray representing a single button with its specific properties.String
typeThe type of button (e.g., “QUICK_REPLY”, “URL”, “PHONE_NUMBER”, “FLOW”, “OTP”). To read Meta Business’s official documentation on buttons, click [here].String
textText to be displayed on the button.String

Response

NAMEDESCRIPTIONTYPE
codeError code.Int
errorError name.String
msgError explanation.String
dataObject containing the relevant payload data.Object
template_idThe unique ID of the template in Meta. This ID does not change upon editing.String
nameThe name of the template that was edited.String
statusThe current status of the template after the edit. After being edited, the template enters a review process and its status will be “PENDING” until Meta approves it again, at which point it will change to “APPROVED”. The example provided shows “APPROVED”, which implies that the review process has already been completed.String
Possible Response Codes
				
					$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://wv{{wolkvox_server}}.wolkvox.com/api/v2/whatsapp.php?api=edit_template',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_POSTFIELDS =>'{
    "connector_id": "",
    "name": "",
    "components": [
        {
            "type": "HEADER",
            "format": "TEXT",
            "text": "",
            "example": {
                "header_text": [
                    ""
                ]
            }
        },
        {
            "type": "BODY",
            "text": "",
            "example": {
                "body_text": [
                    [
                        ""
                    ]
                ]
            }
        },
        {
            "type": "FOOTER",
            "text": "Use the buttons below to manage your marketing subscriptions"
        },
        {
            "type": "BUTTONS",
            "buttons": [
                {
                    "type": "QUICK_REPLY",
                    "text": "Unsubcribe from Promos"
                },
                {
                    "type": "QUICK_REPLY",
                    "text": "Unsubscribe from All"
                }
            ]
        }
    ]
}',
  CURLOPT_HTTPHEADER => array(
    'wolkvox-token: {{wolkvox-token}}',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

				
			

RESPONSE

				
					{
    "code": "200",
    "error": null,
    "msg": "Template edited successfully",
    "data": {
        "template_id": "",
        "name": "",
        "status": ""
    }
}
				
			

Usamos cookies, se continuar a navegar assumimos que concorda. Pode ler mais sobre a utilização de cookies nas nossas políticas de privacidade e tratamento de dados pessoais

We use cookies, if you continue browsing we will assume that you agree. You can read more about the use of cookies in our privacy policies and treatment of personal data