# Sending Message Template Authentication

If your mobile app offers users the option to receive one-time passwords or verification codes via WhatsApp, you must use an authentication template.

1. The **Authentication Template** already has a default message from Meta, which cannot be modified by the user. An example message in Indonesian is as follows:

> &#x20;“123456 adalah kode verifikasi anda. Demi keamanan, jangan bagikan kode ini.”

{% hint style="info" %}
The message text will adjust to the selected language.
{% endhint %}

2. The Template Authentication provides a ***"Copy Button"*** that makes it easier for recipients to copy the OTP code for entry into a website or application during the verification process.

<figure><img src="/files/NpqHVyuFInk1dQ0K3wK8" alt=""><figcaption></figcaption></figure>

Copy code button authentication templates consist of:

* Preset text: *\<VERIFICATION\_CODE> is your verification code.*
* An optional security disclaimer: *For your security, do not share this code.*
* An optional expiration warning (optional): *This code expires in \<NUM\_MINUTES> minutes.*
* A copy code button.

### Steps for Using WhatsApp Template Authentication

To use the WhatsApp template Authentication, users must follow several steps. Here are the steps and explanations:

1. **Request Whatsapp template Authentication**

   Users can request a template through the developer API dashboard. Visit the website and navigate to the template menu, then click on the **Add Template** button. A pop-up dialog will appear; fill in the language and select the **Authentication** template, then click the **Continue** button.

<figure><img src="/files/0kEhNKngj3fra3AL7xYL" alt="" width="375"><figcaption></figcaption></figure>

2. You can choose to use the Security Recommendation and add expiry time information to the template. The template is provided by default by META.

<figure><img src="/files/koHsROEJPJeBj5XywfBB" alt=""><figcaption></figcaption></figure>

2. Please wait until the submission status changes to **Approved**.

### Sending Authentication Template

**URL:**

```
[POST] https://wa01.ocatelkom.co.id/api/v2/push/message 
```

**Header:**

```json
Authorization : {{JWT_AUTH}}
content-type : application/json
```

**Payload** **Body**

```json
{
    "phone_number": "6281345xxxxxx",
    "message": {
        "type": "template",
        "template":{
            "template_code_id": "{{fill_with_template_code}}",
            "payload": [
             {
                "position": "body",
                "parameters": [
                {
                  "type": "text",
                  "text": "{{fill_with_otp_code}}"
                }
               ]
             },
             {
                "position": "button",
                "parameters": [
                {
                  "sub_type": "url",
                  "index": "0",
                  "parameters":  [
                   {
                     "type": "text",
                     "text": "{{fill_with_otp_code}}"
                   }
                 ]
                }
               ]
             }
            ]
        }
    }
}
```

The <mark style="color:red;">**main**</mark> Object

<table><thead><tr><th width="179">Name</th><th width="122">Type</th><th width="116">Required</th><th>Description</th></tr></thead><tbody><tr><td>phone_number</td><td>String</td><td>Yes</td><td>Destination of phone number<br>Values : <mark style="color:red;"><strong>country code + phone number</strong></mark> (+6281381475159, 6281381475159)</td></tr><tr><td>message</td><td>Object</td><td>Yes</td><td>Contain all message information body</td></tr></tbody></table>

The <mark style="color:red;">**message**</mark> Object

<table><thead><tr><th width="177">Name</th><th width="123">Type</th><th width="116">Required</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>String</td><td>Yes</td><td><p>The type of your message</p><p><strong>Values</strong> : <mark style="color:red;">template</mark></p></td></tr><tr><td>template</td><td>Object</td><td>Yes</td><td>Contain template information </td></tr></tbody></table>

The <mark style="color:red;">**template**</mark> Object

<table><thead><tr><th width="178">Name</th><th width="122">Type</th><th width="116">Required</th><th>Description</th></tr></thead><tbody><tr><td>template_code_id</td><td>String</td><td>Yes</td><td>The registered template message, you will be given the template code id for your requested template<br><strong>Values</strong> : <mark style="color:red;">template code id</mark></td></tr><tr><td>payload</td><td>Array of Object</td><td>Yes</td><td>Contain array of information for specific template</td></tr></tbody></table>

The <mark style="color:red;">**payload Array of Component**</mark> Object

<table><thead><tr><th width="187">Name</th><th width="114">Type</th><th width="129">Required</th><th>Description</th></tr></thead><tbody><tr><td>position</td><td>String</td><td>Yes, if template use this component</td><td>Describe the position type<br><strong>Values</strong> : <mark style="color:red;">header</mark> | <mark style="color:red;">body</mark> | <mark style="color:red;">button</mark></td></tr><tr><td>parameters</td><td>Array of Object</td><td>Yes, if template use this component</td><td>Array containing the content of each position type</td></tr></tbody></table>

The <mark style="color:red;">**Parameters Body Component**</mark> Type Position

<table><thead><tr><th width="187">Name</th><th width="115">Type</th><th width="116">Required</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>String</td><td>Yes</td><td>Describe the type for parameters<br>Values : <mark style="color:red;">text</mark></td></tr><tr><td>text</td><td>String</td><td>Yes</td><td>Contain value of text</td></tr></tbody></table>

The <mark style="color:red;">**Parameters Header Component**</mark> Type Position

<table><thead><tr><th width="128">Name</th><th width="128">Type</th><th width="229">Required</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>String</td><td>Yes</td><td>Describe the type value<br>Values : <mark style="color:red;"><strong>text</strong></mark> | <mark style="color:red;"><strong>image</strong></mark> | <mark style="color:red;"><strong>video</strong></mark> | <mark style="color:red;"><strong>document</strong></mark></td></tr><tr><td>text</td><td>String</td><td>Yes, <br>when <mark style="color:red;">“type” : “text”</mark></td><td>Contain value of text</td></tr><tr><td>image</td><td>Object</td><td>Yes, <br>when <mark style="color:red;">“type” : “image”</mark></td><td>Media object containing image</td></tr><tr><td>video</td><td>Object</td><td>Yes, <br>when <mark style="color:red;">“type” : “video”</mark></td><td>Media object containing video</td></tr><tr><td>document</td><td>Object</td><td>Yes, <br>when <mark style="color:red;">“type” : “document”</mark></td><td>Media object containing document</td></tr></tbody></table>

The <mark style="color:red;">**image, video & document**</mark> Object

<table><thead><tr><th width="128">Name</th><th width="131">Type</th><th width="127">Required</th><th>Description</th></tr></thead><tbody><tr><td>url</td><td>String</td><td>Yes</td><td>The protocol and URL of the media to be sent.<br>Use only with HTTP/HTTPS URLs.</td></tr></tbody></table>

The <mark style="color:red;">**Parameters Button Components**</mark> Type Position

<table><thead><tr><th width="134">Name</th><th width="131">Type</th><th width="127">Required</th><th>Description</th></tr></thead><tbody><tr><td>sub_types</td><td>String</td><td>Yes</td><td>Describe the sub_type value<br>Values : <mark style="color:red;"><strong>quick_reply</strong></mark> | <mark style="color:red;"><strong>url_dynamic</strong></mark></td></tr><tr><td>index</td><td>Number</td><td>Yes</td><td>Contains the sequence number of the button use. The sequence number start from <mark style="color:red;">0</mark></td></tr><tr><td>parameters</td><td>Object</td><td>Yes</td><td>Contains an array of information for a specific sub_type</td></tr></tbody></table>

The <mark style="color:red;">**Parameters sub\_type**</mark> Type Position

<table><thead><tr><th width="128">Name</th><th width="131">Type</th><th width="213">Required</th><th>Description</th></tr></thead><tbody><tr><td>type</td><td>String</td><td>Yes</td><td>The protocol and URL of the media to be sent.<br>Use only with HTTP/HTTPS URLs.</td></tr><tr><td>payload</td><td>String</td><td>Yes, <br>when <mark style="color:red;">“type” : “payload”</mark></td><td>Contain text for the recepient to use to do a quick reply</td></tr><tr><td>text</td><td>String</td><td>Yes, <br>when <mark style="color:red;">“type” : “text”</mark></td><td>Containt text that will be used for dynamic_url</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ocaindonesia.co.id/whatsapp-api/endpoint/sending-message-template-authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
