Skip to content

Kirim pesan

Kirim pesan WhatsApp ke penerima melalui saluran yang terhubung.

Updated View as Markdown

Kirim pesan WhatsApp ke penerima. Pilih type, lalu isi content dengan kolom (field) untuk bentuk pesan tersebut.

Tidak seperti Cloud API milik Meta (messaging_product, phone_number_id), Wazapin mengpakai isi permintaan (body) yang berpusat pada saluran: channel_id, to, type, dan content.

Jenis pesan yang didukung

  • text — Teks biasa dengan balasan kutipan opsional
  • image — Gambar dengan teks takar (caption) opsional
  • video — Video dengan teks takar (caption) opsional
  • audio — File audio dan pesan suara
  • document — PDF dan file dengan teks takar (caption) serta nama file opsional
  • sticker — Stiker WebP
  • location — Pin peta dengan koordinat
  • location_request — Meminta pengguna untuk membagikan lokasi mereka
  • contact — Kartu kontak (gaya vCard)
  • template — Templat Meta yang disetujui (isi/body, header, tombol)
  • buttons — Tombol balasan cepat interaktif (hingga 3 tombol)
  • list — Pemilih daftar interaktif
  • reaction — Reaksi emoji pada pesan yang sudah ada
  • mark_as_read — Tandai pesan penyedia sebagai telah dibaca

Autentikasi

X-Api-Key: YOUR_API_KEY
Content-Type: application/json

Buat kunci di dasbor. Cek Autentikasi.

Isi permintaan (Request body)

  • channel_id string (required) — ID saluran WhatsApp terhubung (misalnya wzp_abc123). Daftar saluran dengan GET /v1/channels.

  • to string (required) — Nomor telepon penerima dalam format internasional tanpa + (misalnya 6281234567890).

  • to_phone string — Alias untuk to. Lebih disukai mengpakai to pada integrasi baru.

  • conversation_id string — ID percakapan opsional. Jika diabaikan, Wazapin akan menyelesaikan atau membuat percakapan untuk to.

  • type string (required) — Jenis pesan. Cek tabel di bawah ini untuk nilai yang didukung dan kolom content yang diperlukan.

  • content object (required) — Payload untuk type yang dipilih. Bentuk berubah per jenis pesan — lihat Konten berdasarkan jenis.

Nilai type yang didukung

type Kolom content yang diperlukan Catatan
text body atau text content.text bisa berupa string atau { "body": "..." }. reply_to.id opsional.
image media_url caption opsional.
video media_url caption opsional.
audio media_url AAC, AMR, MP3, M4A, OGG. Maks 16 MB.
document media_url caption, file_name opsional. Maks 100 MB.
sticker sticker_url atau media_url WebP. Statis ≤ 100 KB, animasi ≤ 500 KB.
template template.name, template.language.code Sering membutuhkan template.components untuk variabel.
buttons body, buttons Hingga 3 tombol { id, title }.
list body, button_text, sections Bagian berisi rows dengan id, title, dan description opsional.
location name, address, latitude, longitude Derajat desimal.
location_request body atau text Meminta pengguna membagikan lokasi.
contact full_name, phone organization opsional.
reaction message_id, reaction from_me, participant opsional.
mark_as_read message_id Menandai pesan penyedia sebagai telah dibaca.

Alias kolom media

Untuk image, video, audio, dan document, Wazapin menerima alias kompatibilitas:

Kolom kanonis Alias yang diterima Catatan
media_url media, url Lebih disukai media_url dalam integrasi publik.
media_type mediaType, type, mediatype Biasanya opsional — disimpulkan dari type tingkat atas.
file_name fileName Terutama untuk document.

Konten berdasarkan jenis

Kolom Diperlukan Deskripsi
content.body Ya* Teks pesan. Lebih disukai untuk integrasi baru.
content.text Ya* String atau { "body": "..." } — alias kompatibilitas.
content.reply_to.id Tidak ID pesan penyedia untuk membalas dengan kutipan.
content.reply_to.participant Tidak Diperlukan dalam beberapa konteks grup atau multi-perangkat.
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "text",
  "content": {
    "body": "Hello! Your order #12345 has been shipped."
  }
}

Panduan: Kirim teks

Kolom Diperlukan Deskripsi
content.media_url Ya URL HTTPS publik (JPEG, PNG). Maks 5 MB.
content.caption Tidak Teks takar di bawah gambar.
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "image",
  "content": {
    "media_url": "https://cdn.example.com/product.jpg",
    "caption": "Check out our new product!"
  }
}

Panduan: Kirim gambar

Kolom Diperlukan Deskripsi
content.media_url Ya URL HTTPS publik.
content.caption Tidak Teks takar opsional.
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "video",
  "content": {
    "media_url": "https://cdn.example.com/demo.mp4",
    "caption": "Product demo"
  }
}

Panduan: Kirim video

Kolom Diperlukan Deskripsi
content.media_url Ya URL HTTPS publik (AAC, AMR, MP3, M4A, OGG). Maks 16 MB.
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "audio",
  "content": {
    "media_url": "https://cdn.example.com/voice-note.ogg"
  }
}

Panduan: Kirim audio

Kolom Diperlukan Deskripsi
content.media_url Ya URL HTTPS publik. Maks 100 MB.
content.file_name Tidak Nama tampilan di obrolan (direkomendasikan).
content.caption Tidak Teks takar opsional.
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "document",
  "content": {
    "media_url": "https://cdn.example.com/invoice.pdf",
    "file_name": "invoice-2026-001.pdf",
    "caption": "Your invoice"
  }
}

Panduan: Kirim dokumen

Templat mengpakai objek content.template bersarang (kompatibel dengan Meta). kamu harus meneruskan components yang cocok dengan struktur templat yang disetujui — bukan hanya name dan language.

Kolom Diperlukan Deskripsi
content.template.name Ya Nama templat yang disetujui.
content.template.language.code Ya Lokal/Locale (en_US, id, …). Harus cocok persis.
content.template.components Sering Parameter header, body, dan button.

Hanya variabel body — body templat: Hi {{1}}, your order {{2}} is on the way.

{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "template",
  "content": {
    "template": {
      "name": "order_confirmation",
      "language": { "code": "en_US" },
      "components": [
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "Jessica" },
            { "type": "text", "text": "SKBUP2-4CPIG9" }
          ]
        }
      ]
    }
  }
}

Gambar header + body — pakai URL gambar HTTPS publik yang dapat diambil oleh Meta.

{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "template",
  "content": {
    "template": {
      "name": "seasonal_promotion",
      "language": { "code": "en_US" },
      "components": [
        {
          "type": "header",
          "parameters": [
            {
              "type": "image",
              "image": { "link": "https://cdn.example.com/summer-sale.jpg" }
            }
          ]
        },
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "Summer Sale" },
            { "type": "text", "text": "SUMMER25" },
            { "type": "text", "text": "25%" }
          ]
        }
      ]
    }
  }
}

Variabel teks header — header templat Hello {{1}}, bersarang di dalam content.template.components.

{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "template",
  "content": {
    "template": {
      "name": "greeting_header",
      "language": { "code": "en_US" },
      "components": [
        {
          "type": "header",
          "parameters": [
            { "type": "text", "text": "Black Friday Sale" }
          ]
        },
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "November 30th" }
          ]
        }
      ]
    }
  }
}

Variabel tombol URLindex berbasis nol; sub_type cocok dengan jenis tombol templat.

{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "template",
  "content": {
    "template": {
      "name": "limited_time_offer",
      "language": { "code": "en_US" },
      "components": [
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "Mark" },
            { "type": "text", "text": "Premium Package" }
          ]
        },
        {
          "type": "button",
          "sub_type": "url",
          "index": "0",
          "parameters": [
            { "type": "text", "text": "summer2024" }
          ]
        }
      ]
    }
  }
}

Tombol balasan cepat (Quick reply) — pakai parameter sub_type: "quick_reply" dan payload.

{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "template",
  "content": {
    "template": {
      "name": "customer_feedback",
      "language": { "code": "en_US" },
      "components": [
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "Sarah" }
          ]
        },
        {
          "type": "button",
          "sub_type": "quick_reply",
          "index": "0",
          "parameters": [
            { "type": "payload", "payload": "yes_helpful" }
          ]
        },
        {
          "type": "button",
          "sub_type": "quick_reply",
          "index": "1",
          "parameters": [
            { "type": "payload", "payload": "no_not_helpful" }
          ]
        }
      ]
    }
  }
}

Panduan: Kirim templat · SDK: templateMessage()

Kolom Diperlukan Deskripsi
content.body Ya Teks pesan di atas tombol.
content.buttons Ya Array berisi { "id", "title" } (maksimal 3).
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "buttons",
  "content": {
    "body": "Would you like to proceed with your order?",
    "buttons": [
      { "id": "btn_yes", "title": "Yes" },
      { "id": "btn_no", "title": "No" }
    ]
  }
}

Panduan: Kirim tombol

Kolom Diperlukan Deskripsi
content.body Ya Teks pesan.
content.button_text Ya Label pada tombol pembuka daftar.
content.sections Ya Bagian dengan title dan rows (id, title, description opsional).
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "list",
  "content": {
    "body": "Choose an option",
    "button_text": "View menu",
    "sections": [
      {
        "title": "Support",
        "rows": [
          { "id": "track", "title": "Track order", "description": "Check status" },
          { "id": "help", "title": "Contact CS", "description": "Get help" }
        ]
      }
    ]
  }
}

Panduan: Kirim daftar

Kolom Diperlukan Deskripsi
content.name Ya Nama tempat.
content.address Ya Label alamat.
content.latitude Ya Lintang (derajat desimal).
content.longitude Ya Bujur (derajat desimal).
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "location",
  "content": {
    "name": "Wazapin Office",
    "address": "Jakarta Selatan",
    "latitude": -6.260697,
    "longitude": 106.781616
  }
}

Panduan: Kirim lokasi

Kolom Diperlukan Deskripsi
content.full_name Ya Nama tampilan.
content.phone Ya Nomor telepon kontak.
content.organization Tidak Nama perusahaan atau grup.
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "contact",
  "content": {
    "full_name": "Wazapin Support",
    "phone": "628111111111",
    "organization": "Wazapin"
  }
}

Panduan: Kirim kontak

Kolom Diperlukan Deskripsi
content.message_id Ya ID pesan penyedia dari webhook atau GET /v1/messages/{id}.
content.reaction Ya Emoji (string kosong dapat menghapus reaksi pada beberapa penyedia).
content.from_me Tidak Default-nya true.
content.participant Tidak Diperlukan dalam beberapa konteks grup.
{
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "type": "reaction",
  "content": {
    "message_id": "wamid.HBgNMTU1NTE...",
    "reaction": "👍"
  }
}

Panduan: Kirim reaksi

Respons

Saat berhasil, API mengembalikan status 201 Created dengan respons lean:

{
  "id": "9f1fd66d-c37a-4b50-a8c2-b4dca523f9c8",
  "status": "queued",
  "channel_id": "wzp_abc123",
  "to": "6281234567890",
  "created_at": "2026-03-04T06:20:10Z"
}

Respons ini hanya konfirmasi pesan diterima — status pengiriman datang lewat webhook atau polling GET /v1/messages/{messageID} (catatan lengkap, termasuk provider_message_id setelah provider meng-ack) dan GET /v1/messages/{messageID}/status?channel_id=.... Cek Siklus hidup pesan.

Jenis tingkat lanjut

API juga mendukung cta_url, media_carousel, product_carousel, single_product, multi_product, catalog, link, poll, address, presence, edit_message, and delete_message. Fitur-fitur ini tersedia dalam implementasi tetapi belum dicakup oleh panduan memulai (getting-started).

Terkait

Navigation

Type to search…

↑↓ navigate↵ selectEsc close