WhatsApp API
  • Getting Started
  • Response Code
    • HTTP Status Codes
    • Error Messages
    • Success Messages
    • Error Codes
  • Authorization
  • Endpoint
    • Sending Message Template
    • Sending Message Template Authentication
    • Sending Media Message Template
    • Check Message Status
  • Kembali ke OCA API Documentation
Powered by GitBook
On this page
Export as PDF
  1. Endpoint

Sending Message Template Authentication

PreviousSending Message TemplateNextSending Media Message Template

Last updated 3 months ago

Whatsapp telah merelease fitur baru yaitu template Authentication With One Time Password Buttons, fitur ini dikhususkan untuk pengiriman pesan yang digunakan untuk keperluan autentikasi dan verifikasi menggunakan kode OTP, berikut beberapa hal terkait kapabilitas template Authentication.

  1. Template Authentication sudah memiliki kalimat pesan default dari Meta, dimana user tidak dapat melakukan perubahan kalimat pesan, untuk contoh kalimat pesan Bahasa Indonesia akan seperti di bawah ini:

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

Kalimat pesan akan menyesuaian dengan Bahasa yang dipilih.

  1. Template Authentication menyediakan “Copy Button” yang akan memudahkan penerima untuk melakukan copy kode otp untuk dimasukkan ke website atau applikasi pada saat proses verifikasi.

  1. Tidak diperbolehkan menggunakan media pada pesan template Authentication

  2. Konten dinamis hanya boleh berisi number, text dan tidak boleh menggunakan symbol ataupun karakter

Langkah-langkah penggunaan whatsapp template Authentication

Untuk dapat menggunakan whatsapp template Authentication terdapat beberapa hal yang harus dilakukan oleh user, berikut Langkah-langkah dan penjelasannya

  1. Request Whatsapp template Authentication

  1. Silahkan masukkan wording berikut “[kode] adalah kode verifikasi anda. Demi keamanan, jangan bagikan kode ini.”. Perlu diingat secara default whatsapp sudah menetapkan wording untuk setiap Bahasa yang dipilih, dalam step ini pemberian wording digunakan untuk pencatatan di system OCA saja.

  2. Silahkan tunggu proses pengajuan sampai status pengajuan berubah menjadi Approved.

  3. Selanjutnya untuk penggunaan API dapat menggunakan payload request seperti ini:

API URL: /whatsapp/v2/send/message

METHOD: POST

AUTHENTICATION: Bearer {{jwt_token}}

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

User dapat melakukan request template melalui dashboard developer api, silahkan kunjungin website di , lalu klik menu Whatsapp Template dan klik tombol Add Template, lalu akan muncul pop up dialog, silahkan untuk mengisi language dan memilih template Authentication lalu klik tombol Continue.

Lihat untuk detail authentication

https://developer.ocaindonesia.co.id
Auhtorization