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:

“123456 adalah kode verifikasi anda. Demi keamanan, jangan bagikan kode ini.”

The message text will adjust to the selected language.

  1. 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.

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.

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

  1. Please wait until the submission status changes to Approved.

Sending Authentication Template

URL:

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

Header:

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

Payload Body

{
    "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 main Object

Name
Type
Required
Description

phone_number

String

Yes

Destination of phone number Values : country code + phone number (+6281381475159, 6281381475159)

message

Object

Yes

Contain all message information body

The message Object

Name
Type
Required
Description

type

String

Yes

The type of your message

Values : template

template

Object

Yes

Contain template information

The template Object

Name
Type
Required
Description

template_code_id

String

Yes

The registered template message, you will be given the template code id for your requested template Values : template code id

payload

Array of Object

Yes

Contain array of information for specific template

The payload Array of Component Object

Name
Type
Required
Description

position

String

Yes, if template use this component

Describe the position type Values : header | body | button

parameters

Array of Object

Yes, if template use this component

Array containing the content of each position type

The Parameters Body Component Type Position

Name
Type
Required
Description

type

String

Yes

Describe the type for parameters Values : text

text

String

Yes

Contain value of text

The Parameters Header Component Type Position

Name
Type
Required
Description

type

String

Yes

Describe the type value Values : text | image | video | document

text

String

Yes, when “type” : “text”

Contain value of text

image

Object

Yes, when “type” : “image”

Media object containing image

video

Object

Yes, when “type” : “video”

Media object containing video

document

Object

Yes, when “type” : “document”

Media object containing document

The image, video & document Object

Name
Type
Required
Description

url

String

Yes

The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs.

The Parameters Button Components Type Position

Name
Type
Required
Description

sub_types

String

Yes

Describe the sub_type value Values : quick_reply | url_dynamic

index

Number

Yes

Contains the sequence number of the button use. The sequence number start from 0

parameters

Object

Yes

Contains an array of information for a specific sub_type

The Parameters sub_type Type Position

Name
Type
Required
Description

type

String

Yes

The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs.

payload

String

Yes, when “type” : “payload”

Contain text for the recepient to use to do a quick reply

text

String

Yes, when “type” : “text”

Containt text that will be used for dynamic_url

Last updated