Pesan

/v1/messages

Gunakan node messages untuk mengirim teks, media, kontak, lokasi, dan pesan interaktif, serta template pesan kepada pelanggan Anda.

Lihat panduan berikut untuk informasi terkait jenis pesan tertentu yang dapat Anda kirimkan: Pesan Teks, Pesan Media, Pesan Kontak dan Lokasi, Pesan Interaktif, Template Pesan, Template Pesan Media, dan Template Pesan Interaktif.

Sebelum Memulai

Anda memerlukan:

  • Autentikasi diri Anda dan terima token autentikasi yang memungkinkan Anda mengakses layanan. Lihat dokumentasi Login dan Autentikasi untuk mengetahui informasi selengkapnya tentang cara melakukannya.
  • Untuk memverifikasi akun WhatsApp yang ingin dikirimi pesan dan mendapatkan ID pengguna WhatsApp-nya, lihat dokumentasi Kontak untuk informasi selengkapnya tentang cara melakukan ini.
  • Penuhi persyaratan layanan kontrol pemotongan untuk pesan.

Mulai dari v2.39 ke atas, Anda tidak perlu memanggil node kontak sebelum mengirim pesan.

Batasan

  • Jenis pesan berikut ini didukung: teks, template pesan, gambar, dokumen dan audio.
  • Pesan teks dapat sepanjang maksimal 4.096 karakter.

Membuat

Anda mengirim pesan dengan membuat panggilan POST ke node /messages apa pun jenis pesannya. Isi badan pesan JSON berbeda untuk setiap jenis pesan (teks, gambar, dsb.).

Parameter

Berikut ini adalah parameter utama yang digunakan dalam permintaan POST /messages:

NamaDeskripsi (Klik panah di kolom kiri untuk opsi yang didukung.)

audio

object

Diperlukan saat type=audio.

Objek media berisi audio.

biz_opaque_callback_data

string

Opsional.

String arbitrer, berguna untuk pelacakan.


Misalnya, Anda dapat meneruskan ID template pesan di kolom ini untuk melacak perjalanan pelanggan Anda mulai dari pesan pertama yang Anda kirim. Anda kemudian dapat melacak ROI berbagai jenis template pesan untuk menentukan yang paling efektif.


Semua aplikasi yang berlangganan kolom webhook messages di Akun WhatsApp Business bisa mendapatkan string ini, karena disertakan dalam objek statuses di payload webhook.


Cloud API tidak memproses kolom ini, melainkan hanya menampilkannya sebagai bagian dari webhook pesan yang terkirim/tersampaikan/dibaca.


Maksimal 512 karakter.


Cloud API saja.

contacts

object

Diperlukan saat type=contacts.

Objek contacts.

context

object

Diperlukan jika membalas pesan di percakapan.

Objek yang berisi ID pesan sebelumnya yang Anda balas. Contoh:


{"message_id":"MESSAGE_ID"}


Cloud API saja.

document

object

Diperlukan saat type=document.

Objek media berisi dokumen.

hsm

object

Berisi objek hsm. Opsi ini tidak digunakan lagi pada On-Premises API v2.39. Gunakan objek template sebagai gantinya.


On-Premises API saja.

image

object

Diperlukan saat type=image.

Objek media berisi gambar.

interactive

object

Diperlukan saat type=interactive.

Objek interactive. Komponen dari setiap objek interactive umumnya mengikuti pola yang konsisten: header, body, footer, dan action.

location

object

Diperlukan saat type=location.

Objek location.

messaging_product

string

Diperlukan

Layanan pesan digunakan untuk permintaan tersebut. Gunakan "whatsapp".


Cloud API saja.

preview_url

boolean

Diperlukan jika type=text.

Memungkinkan pratinjau URL dalam pesan teks — Lihat Mengirim URL dalam Pesan Teks. Kolom ini opsional jika tidak menyertakan URL dalam pesan Anda. Nilai:false (default), true.


On-Premises API saja. Pengguna Cloud API dapat menggunakan fungsi yang sama pada kolom preview_url di dalam objek teks.

recipient_type

string

Opsional.

Saat ini, Anda hanya dapat mengirim pesan ke perorangan. Atur ini sebagai individual.


Default: individual

status

string

Status pesan. Anda dapat menggunakan kolom ini untuk menandai pesan sebagai read. Lihat panduan berikut untuk informasi:


sticker

object

Diperlukan saat type=sticker.

Objek media berisi stiker.


Cloud API: Di samping semua jenis stiker masuk, stiker statis dan animasi keluar pihak ketiga juga didukung. Stiker statis harus berukuran 512x512 pixel dan tidak boleh melebihi 100 KB. Stiker animasi harus berukuran 512x512 pixel dan tidak boleh melebihi 500 KB.


On-Premises API: Di samping semua jenis stiker masuk, hanya stiker keluar statis pihak ketiga yang didukung. Stiker statis harus berukuran 512x512 pixel dan tidak boleh melebihi 100 KB. Stiker animasi tidak didukung.

template

object

Diperlukan saat type=template.

Objek template.

text

object

Diperlukan untuk pesan teks.

Objek text.

to

string

Diperlukan.

ID WhatsApp atau nomor telepon pelanggan yang hendak Anda kirimi pesan. Lihat Format Nomor Telepon.


Jika diperlukan, pengguna On-Premises API bisa mendapatkan nomor ini dengan memanggil contacts endpoint.

type

string

Opsional.

Jenis pesan yang ingin Anda kirim. Jika dihilangkan, defaultnya adalah text.

Objek Teks

NamaDeskripsi

body

Wajib.

Berisi teks pesan, yang dapat berisi URL dan pemformatan.

Objek Media

Untuk On-Premises API, ID objek media ditampilkan saat media berhasil diunggah ke klien WhatsApp Business di tempat/referensi melalui endpoint media.

NameDescription

id

string

Required when type is audio, document, image, sticker, or video and you are not using a link.


The media object ID. Do not use this field when message type is set to text.

link

string

Required when type is audio, document, image, sticker, or video and you are not using an uploaded media ID (i.e. you are hosting the media asset on your public server).

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


Do not use this field when message type is set to text.


Cloud API users only:


  • See Media HTTP Caching if you would like us to cache the media asset for future messages.
  • When we request the media asset from your server you must indicate the media's MIME type by including the Content-Type HTTP header. For example: Content-Type: video/mp4. See Supported Media Types for a list of supported media and their MIME types.

caption

string

Optional.


Media asset caption. Do not use with audio or sticker media.


On-Premises API users:

  • For v2.41.2 or newer, this field is is limited to 1024 characters.
  • Captions are currently not supported for document media.

filename

string

Optional.


Describes the filename for the specific document. Use only with document media.


The extension of the filename will specify what format the document is displayed as in WhatsApp.

provider

string

Optional. On-Premises API only.

This path is optionally used with a link when the HTTP/HTTPS link is not directly accessible and requires additional configurations like a bearer token. For information on configuring providers, see the Media Providers documentation.

Objek Kontak

Di dalam contacts, Anda dapat melapis objek berikut: addresses, emails, name, org, phone, dan urls. Objek jamak harus dibungkus dalam array seperti yang ditunjukkan pada contoh di bawah ini.

NameDescription

addresses

object

Optional.

Full contact address(es) formatted as an addresses object. The object can contain the following fields:

streetstringOptional. Street number and name.

citystringOptional. City name.

statestringOptional. State abbreviation.

zipstringOptional. ZIP code.

countrystringOptional. Full country name.

country_codestringOptional. Two-letter country abbreviation.

typestringOptional. Standard values are HOME and WORK.

birthday

Optional.

YYYY-MM-DD formatted string.

emails

object

Optional.

Contact email address(es) formatted as an emails object. The object can contain the following fields:

emailstringOptional. Email address.

typestringOptional. Standard values are HOME and WORK.

name

object

Required.

Full contact name formatted as a name object. The object can contain the following fields:

formatted_namestringRequired. Full name, as it normally appears.

first_namestringOptional*. First name.

last_namestringOptional*. Last name.

middle_namestringOptional*. Middle name.

suffixstringOptional*. Name suffix.

prefixstringOptional*. Name prefix.


*At least one of the optional parameters needs to be included along with the formatted_name parameter.

org

object

Optional.

Contact organization information formatted as an org object. The object can contain the following fields:

companystringOptional. Name of the contact's company.

departmentstringOptional. Name of the contact's department.

titlestringOptional. Contact's business title.

phones

object

Optional.

Contact phone number(s) formatted as a phone object. The object can contain the following fields:

phonestringOptional. Automatically populated with the `wa_id` value as a formatted phone number.

typestringOptional. Standard Values are CELL, MAIN, IPHONE, HOME, and WORK.

wa_idstringOptional. WhatsApp ID.

urls

object

Optional.

Contact URL(s) formatted as a urls object. The object can contain the following fields:

urlstringOptional. URL.

typestringOptional. Standard values are HOME and WORK.

Contoh objek contacts dengan objek jamak berlapis di dalamnya:

"contacts": [
    {
        "addresses": [
            {
                "city": "city name",
                "country": "country name",
                "country_code": "code",
                "state": "Contact's State",
                "street": "Contact's Street",
                "type": "Contact's Address Type",
                "zip": "Contact's Zip Code"
            }
        ],
        "birthday": "birthday",
        "emails": [
            {
                "email": "email",
                "type": "HOME"
            },
            {
                "email": "email",
                "type": "WORK"
            }
        ],
        "name": {
            "first_name": "first name value",
            "formatted_name": "formatted name value",
            "last_name": "last name value",
            "suffix": "suffix value"
        },
        "org": {
            "company": "company name",
            "department": "dep name",
            "title": "title"
        },
        "phones": [
            {
                "phone": "Phone number",
                "wa-id": "WA-ID value",
                "type": "MAIN"
            },
            {
                "phone": "Phone number",
                "type": "HOME"
            },
            {
                "phone": "Phone number",
                "type": "WORK"
            }
        ],
        "urls": [{
            "url": "some url",
            "type": "WORK"
        }]
    }
]

Objek Lokasi

NameDescription

latitude

Required.

Location latitude in decimal degrees.

longitude

Required.

Location longitude in decimal degrees.

name

Required.

Name of the location.

address

Required.

Address of the location.

Objek Template

Di dalam template, Anda dapat menyusun objek components dan language.

Berawal dalam v2.27.8, namespace template harus berupa namespace yang terkait dengan WABA yang memiliki nomor telepon pada klien WhatsApp Business di tempat saat ini. Otherwise, the message will fail to send.

Selain itu, mulai v2.41 dan seterusnya, namespace akan menjadi kolom opsional.

NamaDeskripsi

namespace

Wajib.

Namespace template.


Dimulai dari v2.27.8, ini haruslah namespace yang terkait dengan akun WhatsApp Business yang memiliki nomor telepon yang terkait dengan klien API WhatsApp Business saat ini. Jika tidak, pesan akan gagal terkirim.

name

Wajib.

Nama template.

language

Wajib.

Menentukan bahasa template yang dapat di-render. Hanya kebijakan bahasa deterministic yang berfungsi dengan pesan template media. Lihat bagian Bahasa untuk informasi selengkapnya.

components

Opsional.

Array yang berisi parameter pesan.

Objek Komponen

Di dalam components, Anda bisa menyusun objek parameters. Selain itu, Anda dapat mengatur type ke button.

NamaDeskripsi

type

Wajib.

Mendeskripsikan jenis component.
Nilai:header, body, footer

parameters

Opsional.

Array yang berisi konten pesan.

Objek Parameter

NamaDeskripsi

type

Wajib.

Mendeskripsikan jenis parameter.
Nilai:text, currency, date_time, image, document, video


Jenis media (image, document, dan video) mengikuti format yang sama seperti yang digunakan dalam pesan media standar, lihat dokumentasi Media untuk informasi selengkapnya. Saat ini hanya dokumen PDF yang didukung untuk template pesan media.


Untuk informasi selengkapnya tentang currency dan date_time, lihat bagian Parameter yang Dapat Dilokalkan. Parameter currency dan date_time untuk pesan template menggunakan fallback_value sebagai pengganti default. Lihat sampel Permintaan di atas sebagai contoh.

Jenis Tombol

Di dalam objek components, Anda dapat mengatur type ke button. Ini adalah parameter tombol:

NamaDeskripsi

sub_type

Wajib.

Jenis tombol yang sedang dibuat.
Nilai:quick_reply, url, copy_code (available from 2.49 and onwards)

index

Wajib.

Indeks posisi tombol. Anda dapat memiliki hingga 10 tombol menggunakan nilai indeks 0-9.

parameters

Wajib.

Parameter untuk tombol, yang diatur pada saat pembuatan di Pengelola Bisnis Anda. Sertakan parameter berikut:

  • type (Wajib): Menunjukkan jenis parameter untuk tombol. Nilai yang didukung adalah payloadtext, dan coupon_code.
  • payload (Wajib untuk tombol quick_reply): Muatan yang ditentukan developer dan akan ditampilkan saat tombol diklik selain teks tampilan pada tombol.
  • text (Wajib untuk tombol url): Sufiks yang disediakan developer untuk ditambahkan ke tombol URL dinamis yang dibuat sebelumnya.
  • coupon_code (Wajib untuk tombol copy_code) (tersedia dari versi 2.49 dan selanjutnya): Developer menyediakan kode kupon yang disalin ketika tombol salin kode diklik.

Contoh jenis button dengan sub_type quick_reply:

 {
    "type": "button",
    "sub_type": "quick_reply",
    "index": 0,
    "parameters": 
     [{
    	"type": "payload",
    	"payload": "Yes-Button-Payload"
     }]
 } 

Contoh jenis button dengan sub_type copy_code

    
 { 
    "type": "button", 
    "sub_type": "copy_code", 
    "index": 0, 
    "parameters": 
    [{ 
     "type": "coupon_code", 
     "coupon_code": "DISCOUNT20" 
    }] 
 }

Objek Hsm

Objek hsm tidak berlaku lagi dengan v2.39 dari referensi/on-premises WhatsApp Business. Gunakan objek template sebagai gantinya.

Nama Deskripsi

namespace

Wajib.

Namespace yang akan digunakan. Dimulai dari v2.2.7, jika namespace tidak cocok dengan element_name, pesan akan gagal terkirim.

element_name

Wajib.

Nama elemen yang menunjukkan template mana yang akan digunakan dalam namespace. Dimulai dari v2.2.7, jika element_name tidak cocok dengan namespace, pesan akan gagal terkirim.

language

Wajib.

Mengizinkan spesifikasi bahasa deterministik. Lihat bagian Bahasa untuk informasi selengkapnya.


Kolom ini digunakan untuk mengizinkan opsi fallback, tetapi ini sudah tidak berlaku lagi mulai v2.27.8.

localizable_params

Wajib.

Kolom ini adalah array nilai yang harus diterapkan ke variabel di template. Lihat bagian Parameter yang Dapat Dilokalkan untuk informasi selengkapnya.

Objek Interaktif

The interactive object generally contains 4 main components: header, body, footer, and action. Additionally, some of those components can contain one or more different objects:

  • Inside header, you can nest media objects.
  • Inside action, you can nest section and button objects.
NameDescription

type

string

Required.

The type of interactive message you want to send. Supported values:

  • list: Use it for List Messages.
  • button: Use it for Reply Buttons.
  • product: Use it for Single-Product Messages.
  • product_list: Use it for Multi-Product Messages.
  • catalog_message: Use it for Catalog Messages.
  • flow: Use it for Flows Messages.

header

object

Required for type product_list. Optional for other types.

Header content displayed on top of a message. You cannot set a header if your interactive object is of product type.


The header object contains the following fields:

documentobjectRequired if type is set to document. Contains the media object with the document.

imageobjectRequired if type is set to image. Contains the media object with the image.

videoobjectRequired if type is set to video. Contains the media object with the video.

textstringRequired if type is set to text. Text for the header. Formatting allows emojis, but not markdown. Maximum length: 60 characters.

typestringRequired. The header type you would like to use. Supported values are:

text – for List Messages, Reply Buttons, and Multi-Product Messages.

video – for Reply Buttons.

image – for Reply Buttons.

document – for Reply Buttons.

body

object

Optional for type product. Required for other message types.

An object with the body of the message.


The body object contains the following field:

textstringRequired if body is present. The content of the message. Emojis and markdown are supported. Maximum length: 1024 characters.

footer

object

Optional.

An object with the footer of the message.


The footer object contains the following field:

textstringRequired if footer is present. The footer content. Emojis, markdown, and links are supported. Maximum length: 60 characters.

action

object

Required.

An action object with what you want the user to perform after reading the message. See action object for full information.

Objek Tindakan

NameDescription

button

string

Required for List Messages.

Button content. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters.

buttons

object

Required for Reply Button Messages.

A button object. The object can contain the following parameters:

type – The only supported option is reply for Reply Button Messages.

title – Button title. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters.

id – Unique identifier for your button. This ID is returned in the webhook when the button is clicked by the user. Maximum length: 256 characters.


Tidak boleh ada spasi di depan atau di belakang saat mengatur ID.

sections

array of objects

Required for List Messages and Multi-Product Messages.

Array of section objects. There is a minimum of 1 and maximum of 10. See section object.

catalog_id

string

Required for Single-Product Messages and Multi-Product Messages.

Unique identifier of the Facebook catalog linked to your WhatsApp Business Account. This ID can be retrieved via Commerce Manager.

product_retailer_id

string

Required for Single-Product Messages and Multi-Product Messages.

Unique identifier of the product in a catalog. Maximum 100 characters for both Single-Product and Multi-Product messages.


To get this ID, go to Commerce Manager, select your Facebook Business account, and you will see a list of shops connected to your account. Click the shop you want to use. On the left-side panel, click Catalog > Items, and find the item you want to mention. The ID for that item is displayed under the item's name.

mode

string

Optional for Flows Messages.

The current mode of the Flow, either draft or published.


Default: published

flow_message_version

string

Required for Flows Messages.

Must be 3.

flow_token

string

Required for Flows Messages.

A token that is generated by the business to serve as an identifier.

flow_id

string

Required for Flows Messages.

Unique identifier of the Flow provided by WhatsApp.

flow_cta

string

Required for Flows Messages.

Text on the CTA button, eg. "Signup".


Maximum length: 20 characters (no emoji).

flow_action

string

Optional for Flows Messages.

navigate or data_exchange. Use navigate to predefine the first screen as part of the message. Use data_exchange for advanced use-cases where the first screen is provided by your endpoint.


Default: navigate

flow_action_payload

object

Optional for Flows Messages.

Required only if flow_action is navigate. The object can contain the following parameters:

screenstringRequired. The id of the first screen of the Flow.

dataobjectOptional. The input data for the first screen of the Flow. Must be a non-empty object.

Section Object

NameDescription

title

string

Required if the message has more than one section.

Title of the section. Maximum length: 24 characters.

rows

array of objects

Required for List Messages.

Contains a list of row objects. Limited to 10 rows across all sections.


Each row object contains the following fields:

titlestringRequired. Maximum length: 24 characters.

IDstringRequired. Maximum length: 200 characters.

descriptionstringOptional. Maximum length: 72 characters.

product_items

array of objects

Required for Multi-Product Messages.

Array of product objects. There is a minimum of 1 product per section and a maximum of 30 products across all sections.


Each product object contains the following field:

product_retailer_idstringRequired for Multi-Product Messages. Unique identifier of the product in a catalog. To get this ID, go to Commerce Manager, select your account and the shop you want to use. Then, click Catalog > Items, and find the item you want to mention. The ID for that item is displayed under the item's name.

Contoh

Pesan audio:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "audio",
  "audio": {
      "id": "your-media-id",
  }
}

Pesan dokumen, menggunakan filename:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "document",
  "document": {
      "id": "your-media-id",
      "filename": "your-document-filename"
  }
}

Pesan dokumen, menggunakan link:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "document",
  "document": {
      "link": "http(s)://the-url"
      "provider": {
          "name" : "provider-name"
      }     
    }
}

Pesan video, menggunakan link:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "video",  
  "video": {
      "link": "http(s)://the-url"
      "provider": {
          "name" : "provider-name"
      }
    }
  }
}

Pesan teks:

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "text",
  "text": {
      "body": "your-message-content"
  }
}

Pesan interaktif (daftar):

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "interactive",
  "interactive":{
    "type": "list",
    "header": {
      "type": "text",
      "text": "your-header-content-here"
    },
    "body": {
      "text": "your-text-message-content-here"
    },
    "footer": {
      "text": "your-footer-content-here"
    },
    "action": {
      "button": "cta-button-content-here",
      "sections":[
        {
          "title":"your-section-title-content-here",
          "rows": [
            {
              "id":"unique-row-identifier-here",
              "title": "row-title-content-here",
              "description": "row-description-content-here",           
            }
          ]
        },
        {
          "title":"your-section-title-content-here",
          "rows": [
            {
              "id":"unique-row-identifier-here",
              "title": "row-title-content-here",
              "description": "row-description-content-here",           
            }
          ]
        },
        ...
      ]
    }
  }

}

Pesan interaktif (tombol balas):

POST /v1/messages
{
  "recipient_type": "individual",
  "to": "whatsapp-id",
  "type": "interactive",
  "interactive": {
    "type": "button",
    "header": { # optional
      "type": "text" | "image" | "video" | "document",
      "text": "your text"
      # OR
      "document": {
        "id": "your-media-id",
        "filename": "some-file-name"
      }
      # OR
      "document": {
        "link": "the-provider-name/protocol://the-url",
        "provider": {
          "name": "provider-name",
        },
        "filename": "some-file-name"
      },
      # OR
      "video": {
        "id": "your-media-id"
      }
      # OR
      "video": {
        "link": "the-provider-name/protocol://the-url",
        "provider": {
          "name": "provider-name"
        }
      }
      # OR
      "image": {
        "id": "your-media-id"
      }
      # OR
      "image": {
        "link": "http(s)://the-url",
        "provider": {
          "name": "provider-name"
        }
      }
    }, # end header
    "body": {
      "text": "your-text-body-content"
    },
    "footer": { # optional
      "text": "your-text-footer-content"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "unique-postback-id",
            "title": "First Button’s Title" 
          }
        },
        {
          "type": "reply",
          "reply": {
            "id": "unique-postback-id",
            "title": "Second Button’s Title" 
          }
        }
      ] 
    } # end action   
  } # end interactive

}

Pesan interaktif (Pesan Multiproduk dan Satu Produk):

{ 
  "recipient_type": "individual",
  "to" : "{{Recipient-WA-ID}}",
  "type": "interactive",
  "interactive": {
    "type": "product",
    "body": {
      "text": "body text"
    },
    "footer": {
      "text": "footer text"
    },
    "action": {
      "
      
      _id": "catalog-ID",
      "product_retailer_id": "product-ID"
    }
  }
}

Pesan interaktif (Pesan Multiproduk):

{ 
  "recipient_type": "individual",
  "to" : "whatsapp-id",
  "type": "interactive",
  "interactive": 
    {
    "type": "product_list",
    "Header":{
       "type": "text",
        "text": "text-header-content"
     },
     "body":{
        "text": "text-body-content"
      },
     "footer":{
        "text":"text-footer-content"
     },
     "action":{
        "catalog_id":"catalog-id",
        "sections": [
             {
             "title": "section-title",             
             "product_items": [
                  { "product_retailer_id": "product-SKU-in-catalog" },
                  { "product_retailer_id": "product-SKU-in-catalog" },
                            ...
              ]},
              {
              "title": "the-section-title",
              "product_items": [
                 { "product_retailer_id": "product-SKU-in-catalog" }
                           ...
              ]},
               ...
       ]
     },  
    }
}

Pesan interaktif (Pesan Katalog):

{ 
  "recipient_type": "individual",
  "to" : "whatsapp-id",
  "type": "interactive",
  "interactive": 
    {
    "type": "catalog_message",
     "body":{
        "text": "text-body-content"
      },
     "footer":{
        "text":"text-footer-content"
     },
     "action":{
        "name": "catalog_message",
      	"parameters":{ 
      	  "thumbnail_product_retailer_id": "product-SKU-in-catalog"
      	}
     },  
    }
}

Pesan interaktif (Alur):

{
  "recipient_type": "individual",
  "to": "{{Recipient-WA-ID}}",
  "type": "interactive",
  "interactive": {
    "type": "flow",
    "header": {
      "type": "text",
      "text": "Flow message header"
    },
    "body": {
      "text": "Flow message body"
    },
    "footer": {
      "text": "Flow message footer"
    },
    "action": {
      "name": "flow",
      "parameters": {
        "flow_message_version": "3",
        "flow_token": "AQAAAAACS5FpgQ_cAAAAAD0QI3s",
        "flow_id": "<FLOW_ID>",
        "flow_cta": "Book!",
        "flow_action": "navigate",
        "flow_action_payload": {
          "screen": "<SCREEN_ID>",
          "data": { # optional
            "user_name": "name",
            "user_age": 25
          }
        }
      }
    }
  }
}

Berikut ini menampilkan contoh payload dalam tanggapan. Objek meta dan kesalahan dihilangkan untuk mempersingkat.

{
  "messages": [{ 
    "id": "message-id" 
  }]    
}

Jika permintaan berhasil, Anda akan menerima tanggapan dengan ID pesan. Jika permintaan menampilkan bagian errors, periksa pesan asal dan perbaiki kesalahan sebelum mengirim ulang permintaan. Untuk informasi selengkapnya tentang kesalahan, lihat Kode Kesalahan Klien WhatsApp Business di tempat/referensi dan Kode Status HTTP.

Berlaku untuk bisnis di Brasil, Kolombia, dan Singapura, mulai 12 September 2023. Berlaku untuk semua bisnis mulai 12 Oktober 2023.

Jika permintaan ditahan untuk penilaian kualitas, tanggapan akan berisi properti message_status dengan pesan yang menunjukkan bahwa pesan tersebut tidak dikirim segera dan akan dikirim atau dilepas setelah kualitas telah divalidasi. Properti ini hanya akan ada jika pesan ditahan.

    {
      "messages": [{ 
        "id": "message-id",
        "message_status": "Message has been held because quality assessment is pending",
      }]    
    }
    

Pemformatan dalam Pesan Teks

WhatsApp memungkinkan beberapa pemformatan dalam pesan. Untuk memformat seluruh atau sebagian dari pesan, gunakan simbol pemformatan berikut:

PemformatanSimbolContoh

Cetak Tebal

Tanda bintang (*)

Total Anda *$10,50*.

Cetak Miring

Garis bawah (_)

Selamat datang di _WhatsApp_!

Coret

Tilde (~)

Ini ~lebih baik~ yang terbaik!

Code

Tiga tanda kutip terbalik (```)

```print 'Hello World';```

Kinerja

Dalam konteks ini, kinerja mewakili jumlah pesan yang dapat dikirim dalam setiap detik menggunakan klien di tempat/referensi WhatsApp Business. Kinerja maksimum yang dapat dicapai bergantung pada berbagai faktor, faktor terpenting adalah pilihan pengaturan klien Anda dan apakah pesan dikirim ke pengguna baru atau pengguna yang sudah ada — pengaturan sesi enkripsi membutuhkan waktu lebih lama saat mengirim pesan kepada pengguna baru.

Pengaturan KlienPesan Teks Didukung per Detik

Partisi Tunggal

70

Multipartisi (32 partisi)

250

Pertanyaan Umum

Catatan: Jangan kirimkan pesan yang sama berulang-ulang kepada penerima yang sama menggunakan WhatsApp Business API.

Ada beberapa kemungkinan alasan mengapa tingkat pengiriman tidak 100%. Beberapa kasus umum termasuk pengguna yang memiliki akses sporadis ke jaringan, tidak aktif selama jangka waktu tertentu, atau untuk menciptakan pengalaman pengguna berkualitas tinggi.

Pesan yang dapat tersampaikan dengan WhatsApp akan memiliki tingkat pengiriman yang sangat tinggi. Namun, ada banyak alasan mengapa pesan tidak tersampaikan. Anda akan memiliki akses ke status pesan yang tepat dengan memantau panggilan balik Anda. Hal ini berbeda dari pengiriman pesan melalui SMS, contohnya saat Anda tidak memiliki akses ke status tersampaikan yang terakhir. Pengiriman ulang pesan tersebut dapat memberikan hasil yang berbeda.

Pesan mungkin tetap tidak tersampaikan karena telepon pengguna tidak berfungsi, atau baterai habis, atau mereka kehilangan telepon dan menggunakan telepon yang baru serta menonaktifkan SIM-nya. Mungkin saja terdapat kesalahan pada kemampuan klien bisnis untuk terhubung ke jaringan. Mungkin juga panggilan balik (Webhooks) tidak tersampaikan. Anda dapat memantau situasi ini dengan menggunakan node health. Anda dapat mengaktifkan panggilan balik penerimaan server untuk mengetahui bahwa pesan berhasil masuk ke cloud server WhatsApp.

Jika dan ketika pengguna terhubung kembali ke jaringan, semua pesan yang Anda kirim akan tersampaikan kepada mereka. Menerima lebih dari satu pesan dengan isi yang sama akan menjadi pengalaman buruk bagi mereka. Mereka kemungkinan besar akan memblokir Anda atau menyampaikan keluhan. Kemungkinan besar Anda akan diblokir.

Jika Anda mengirim pesan dan menerima ID pesan dari API, Anda telah melakukan apa yang bisa Anda lakukan untuk mengirim pesan ini. Jangan mengirim ulang konten yang sama ke penerima yang sama.

Jika Anda melihat tingkat pengiriman yang rendah dalam jangka waktu yang lama, kirimkan tiket permintaan dukungan ke Dukungan Langsung.

Saat Anda mengirimkan pesan, ketika Anda mendapatkan kembali ID pesan, permintaan pesan berarti telah disimpan di database. Klien API WhatsApp Business akan terus mencoba mengirimkan pesan itu sampai diakui oleh server WhatsApp. Proses ini tidak memiliki linimasa akhir. Server WhatsApp kemudian akan mencoba mengirimkan pesan itu ke ponsel pengguna. Jika ponsel pengguna tidak online, pesan akan disimpan selama 30 hari sebelum dihapus oleh server WhatsApp.

Ya! WhatsApp memungkinkan Anda memformat teks yang diseleksi dalam pesan Anda dengan Tebal, Miring, Coret, atau Monospace.

Saat ini, tidak ada cara untuk mengetahui berapa atau siapa pengguna yang telah memblokir bisnis Anda. Indikator terbaik adalah callback status dan jika Anda tidak menerima status delivered, artinya pengguna telah memblokir bisnis Anda atau mereka tidak memiliki koneksi jaringan. Lihat dokumentasi Webhook untuk perincian selengkapnya.

Jika pengguna telah memblokir bisnis Anda, API Kontak akan terus menampilkan nomor teleponnya sebagai pengguna WhatsApp yang valid. Namun, saat Anda mengirimkan pesan, pesan tidak akan pernah terkirim. Jika itu pesan berbayar, Anda tidak akan dikenai biaya.

Tidak, urutan datangnya pesan tidak dijamin sama dengan saat pesan dikirimkan. Jika urutan penting untuk Anda, pendekatan yang disarankan adalah memperhatikan callback terkirim dari pesan pertama sebelum mengirimkan pesan kedua.

Saat menggunakan node messages, Anda perlu mengatur header Content-Type ke application/json agar Klien API WhatsApp Business dapat menguraikan isi pesan dengan benar. Terdapat pula header Authorization yang harus diatur dan harus berisi token akses yang tidak kedaluwarsa. Lihat dokumentasi Login dan Autentikasi untuk mengetahui informasi tentang cara mendapatkan token dan kapan token kedaluwarsa.

Mungkin ada kasus-kasus di mana Anda membutuhkan lebih banyak waktu untuk menangani permintaan informasi dari pelanggan dan hanya dapat menanggapinya setelah 24 jam. Kami sarankan Anda membuat template pesan untuk:

  • menyampaikan hasilnya kepada pengguna, atau
  • meminta pengguna membalas untuk mengaktifkan jendela layanan pelanggan.

Dalam kedua kasus, pastikan Anda memberikan sebanyak mungkin konteks dalam template pesan yang digunakan. Misalnya:

  • "Halo {{1}}, mengenai masalah yang Anda laporkan, kami dengan berat hati ingin menyampaikan bahwa {{2}}. Maaf atas ketidaknyamanannya."
  • Kami memiliki info baru mengenai tiket Anda. Mohon tanggapi jika Anda ingin melanjutkan dukungan."