Pesan
Kirim Pesan
Kirim pesan teks ke customer lewat WhatsApp, Instagram, atau Messenger.
POST /api/v1/public/messages/send
Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
phone_number | string | tidak | Nomor telepon customer. Gunakan ini untuk mencari customer di channel mana pun. |
customer_id | string | tidak | Customer ID (CUID). Alternatif dari phone_number. |
instagram_username | string | tidak | Username Instagram. Cara pencarian alternatif. |
channel | string | ya | "whatsapp", "instagram", atau "messenger" |
message_type | string | ya | WhatsApp: "text", "image", "document", "audio", "video", "template". Instagram: "text", "image", "media_share". Messenger: "text", "image", "video", "audio", "file". |
content | string | tidak | Isi pesan teks (wajib untuk pesan teks) |
media_url | string | tidak | URL media untuk pesan image/video/audio/file |
reply_to_message_id | string | tidak | Khusus WhatsApp. Kutip/balas pesan sebelumnya — isi dengan wamid pesan masuk (data.message_id atau data.raw.context.id dari webhook). Pesan asli akan tampil sebagai kutipan di atas balasan Anda. |
whatsapp_phone_number_id | string | tidak | ID nomor telepon WhatsApp. Gunakan untuk menentukan nomor bisnis mana yang mengirim pesan. Jika tidak diisi, ditentukan otomatis dari nomor yang terhubung dengan customer atau nomor utama. |
instagram_account_id | string | tidak | ID akun Instagram. Wajib jika customer punya percakapan dengan lebih dari satu akun Instagram. |
facebook_page_id | string | tidak | ID Facebook Page. Wajib jika customer punya percakapan dengan lebih dari satu Facebook Page. |
Catatan: Minimal salah satu dari phone_number, customer_id, atau instagram_username wajib diisi untuk mengidentifikasi customer.
Multi-Akun / Multi-Nomor: Untuk WhatsApp, gunakan whatsapp_phone_number_id untuk menentukan nomor bisnis mana yang mengirim pesan. Jika dikosongkan, API otomatis memakai nomor yang terhubung dengan customer atau nomor utama Anda. Untuk Instagram/Messenger, isi instagram_account_id atau facebook_page_id jika customer punya lebih dari satu percakapan.
Contoh Request
- cURL
- JavaScript
- Python
curl -X POST "https://chat.api.co.id/api/v1/public/messages/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "text",
"content": "Hello! This is a test message.",
"whatsapp_phone_number_id": "clyyy9876543210"
}'
const response = await fetch("https://chat.api.co.id/api/v1/public/messages/send", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
phone_number: "628123456789",
channel: "whatsapp",
message_type: "text",
content: "Hello! This is a test message.",
whatsapp_phone_number_id: "clyyy9876543210" // optional
})
});
import requests
response = requests.post(
"https://chat.api.co.id/api/v1/public/messages/send",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "text",
"content": "Hello! This is a test message.",
"whatsapp_phone_number_id": "clyyy9876543210" # optional
}
)
Response
{
"success": true,
"data": {
"message_id": "msg_xyz789",
"customer_id": "clxxx1234567890",
"whatsapp_phone_number_id": "clyyy9876543210",
"status": "sent",
"channel": "whatsapp",
"timestamp": "2025-01-07T10:30:00.000Z"
}
}
whatsapp_phone_number_id di response menunjukkan nomor bisnis mana yang dipakai untuk mengirim pesan. Ini berguna untuk melacak nomor yang dipakai jika Anda punya beberapa nomor WhatsApp yang terhubung.
Balas / kutip pesan sebelumnya (WhatsApp)
Tambahkan reply_to_message_id agar pesan Anda tampil sebagai balasan yang mengutip pesan sebelumnya. Gunakan wamid dari pesan masuk — tersedia di payload webhook sebagai data.message_id (atau data.raw.context.id jika customer membalas salah satu pesan Anda).
curl -X POST "https://chat.api.co.id/api/v1/public/messages/send" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "6281234567890",
"channel": "whatsapp",
"message_type": "text",
"content": "Betul kak, untuk treatment itu harganya Rp 150.000 😊",
"reply_to_message_id": "wamid.HBgMNjI4MTIzNDU2Nzg5"
}'
Berlaku untuk semua tipe pesan WhatsApp (text, image, document, dll.) — cukup tambahkan reply_to_message_id di samping payload biasa Anda. Pesan yang dirujuk harus pesan terbaru di percakapan yang sama; wamid yang sudah sangat lama mungkin tidak tampil sebagai kutipan.
Kirim Template
Kirim pesan template WhatsApp yang sudah disetujui. Template tidak memerlukan messaging window 24 jam.
POST /api/v1/public/messages/send
Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
phone_number | string | ya | Nomor telepon penerima dalam format E.164 |
channel | string | ya | Harus "whatsapp" |
message_type | string | ya | Harus "template" |
template.name | string | ya | Nama template sesuai yang terdaftar di Meta |
template.language.code | string | ya | Kode bahasa (mis. "en_US", "id") |
template.components | array | tidak | Variabel template untuk header, body, button |
whatsapp_phone_number_id | string | tidak | Tentukan nomor bisnis pengirim. Jika dikosongkan, ditentukan otomatis. |
Contoh dengan Variabel Body
{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "template",
"whatsapp_phone_number_id": "clyyy9876543210",
"template": {
"name": "order_confirmation",
"language": { "code": "id" },
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "John Doe" },
{ "type": "text", "text": "INV-12345" }
]
}
]
}
}
Template dengan Media di Header
Untuk template dengan header berupa gambar, video, atau dokumen, tambahkan komponen header berisi URL media.
{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "template",
"template": {
"name": "promo_with_image",
"language": { "code": "id" },
"components": [
{
"type": "header",
"parameters": [
{ "type": "image", "image": { "link": "https://example.com/promo.jpg" } }
]
},
{
"type": "body",
"parameters": [
{ "type": "text", "text": "FLASH SALE" },
{ "type": "text", "text": "50%" }
]
}
]
}
}
Tipe media header yang didukung:
image- JPEG, PNG (maks 5MB)video- MP4 (maks 16MB)document- PDF, DOC (maks 100MB)
Template dengan Button URL Dinamis
Untuk template dengan button URL dinamis (URL berisi {{1}}), tambahkan komponen button.
{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "template",
"template": {
"name": "order_tracking",
"language": { "code": "id" },
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "INV-12345" }
]
},
{
"type": "button",
"sub_type": "url",
"index": 0,
"parameters": [
{ "type": "text", "text": "tracking-abc123" }
]
}
]
}
}
Template dengan Button Salin Kode
Untuk template marketing dengan button salin kode (kode kupon, kode promo).
{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "template",
"template": {
"name": "promo_code",
"language": { "code": "id" },
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "FLASH SALE" }
]
},
{
"type": "button",
"sub_type": "copy_code",
"index": 0,
"parameters": [
{ "type": "coupon_code", "coupon_code": "SAVE20OFF" }
]
}
]
}
}
Template Autentikasi (OTP)
Untuk template autentikasi dengan kode OTP. Sertakan body sekaligus button salin kode.
{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "template",
"template": {
"name": "otp_verification",
"language": { "code": "id" },
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "123456" }
]
},
{
"type": "button",
"sub_type": "copy_code",
"index": 0,
"parameters": [
{ "type": "coupon_code", "coupon_code": "123456" }
]
}
]
}
}
Untuk template autentikasi, selalu sertakan OTP di parameter body DAN di button salin kode agar pengguna bisa melihat sekaligus menyalin kodenya.
Referensi Parameter Komponen
| Tipe Komponen | Tipe Parameter | Kegunaan |
|---|---|---|
header | text, image, video, document | Variabel atau media header |
body | text, currency, date_time | Variabel teks body |
button (url) | text | Akhiran URL dinamis |
button (copy_code) | coupon_code | Kode kupon/OTP yang disalin |
Template harus sudah disetujui Meta sebelum digunakan. Field components bersifat opsional dan hanya diperlukan jika template Anda punya variabel.
Buat Template
Buat template pesan WhatsApp baru lewat API (langkah 1 dari 2). Endpoint ini hanya menyimpan record template — panggil Ajukan Template berikutnya untuk mengirimnya ke Meta agar disetujui.
POST /api/v1/public/templates
Body Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
template_name | string | ya | Hanya huruf kecil, angka, dan underscore. Harus unik per bahasa. |
category | string | ya | "MARKETING", "UTILITY", atau "AUTHENTICATION" |
language | string | tidak | Kode bahasa (default "en_US"), mis. "id" |
body | string | ya | Teks body pesan. Gunakan {{1}}, {{2}}, ... untuk variabel (berurutan mulai dari 1). |
variables | string[] | tidak | Contoh nilai untuk setiap placeholder {{n}}. Jumlahnya harus sama dengan jumlah placeholder. |
header | object | tidak | { type: TEXT|IMAGE|VIDEO|DOCUMENT, text, media_handle }. Header media memerlukan media_handle dari resumable upload (bukan URL publik). |
footer | string | tidak | Teks footer, maks 60 karakter. |
buttons | object[] | tidak | Array berisi { type: QUICK_REPLY|URL|PHONE_NUMBER|OTP, text, url, phone_number }. |
whatsapp_phone_number_id | string | tidak | Targetkan WABA dari nomor tertentu. Default ke nomor utama yang terhubung. |
Response mengembalikan id template baru dengan status: "PENDING". Template belum dikirim ke Meta — teruskan id tersebut ke Ajukan Template. Untuk template AUTHENTICATION, Meta membuat body secara otomatis (tanpa footer; hanya button OTP).
Contoh Request
- cURL
- JavaScript
- Python
curl -X POST "https://chat.api.co.id/api/v1/public/templates" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_name": "order_update",
"category": "UTILITY",
"language": "id",
"body": "Halo {{1}}, pesanan {{2}} Anda sedang diproses.",
"variables": ["Budi", "INV-12345"]
}'
const response = await fetch("https://chat.api.co.id/api/v1/public/templates", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
template_name: "order_update",
category: "UTILITY",
language: "id",
body: "Halo {{1}}, pesanan {{2}} Anda sedang diproses.",
variables: ["Budi", "INV-12345"],
}),
});
const { data } = await response.json();
const templateId = data.id; // pass to the submit endpoint
import requests
res = requests.post(
"https://chat.api.co.id/api/v1/public/templates",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"template_name": "order_update",
"category": "UTILITY",
"language": "id",
"body": "Halo {{1}}, pesanan {{2}} Anda sedang diproses.",
"variables": ["Budi", "INV-12345"],
},
)
template_id = res.json()["data"]["id"]
Response
{
"success": true,
"data": {
"id": "cmxxx1234567890",
"template_name": "order_update",
"language": "id",
"status": "PENDING",
"category": "UTILITY",
"created_at": "2026-06-19T10:00:00.000Z"
}
}
Ajukan Template ke Meta
Ajukan template yang sudah dibuat ke Meta untuk disetujui (langkah 2 dari 2). Gunakan id template yang dikembalikan oleh Buat Template.
POST /api/v1/public/templates/:id/submit
Jika berhasil, template mendapat meta_template_id dan tetap berstatus PENDING selama ditinjau Meta (beberapa menit hingga 24 jam). Cek Daftar Template / Detail Template secara berkala untuk melihat status akhirnya. Jika Meta menolak, response mengembalikan error dan template menjadi REJECTED beserta alasannya.
Contoh Request
- cURL
- JavaScript
- Python
curl -X POST "https://chat.api.co.id/api/v1/public/templates/TEMPLATE_ID/submit" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
"https://chat.api.co.id/api/v1/public/templates/" + templateId + "/submit",
{ method: "POST", headers: { "Authorization": "Bearer YOUR_API_KEY" } }
);
const { data } = await response.json();
console.log(data.status, data.meta_template_id);
import requests
res = requests.post(
f"https://chat.api.co.id/api/v1/public/templates/{template_id}/submit",
headers={"Authorization": "Bearer YOUR_API_KEY"},
)
print(res.json())
Response
{
"success": true,
"data": {
"id": "cmxxx1234567890",
"template_name": "order_update",
"language": "id",
"status": "PENDING",
"category": "UTILITY",
"meta_template_id": "1234567890123456",
"submitted_at": "2026-06-19T10:00:05.000Z"
}
}
Daftar Template
Ambil semua template pesan WhatsApp milik pengguna yang terautentikasi. Gunakan ini untuk mencari template yang tersedia beserta status persetujuannya.
GET /api/v1/public/templates
Query Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
status | string | tidak | Filter berdasarkan status: "APPROVED", "PENDING", "REJECTED", "PAUSED", "DISABLED" |
category | string | tidak | Filter berdasarkan kategori: "MARKETING", "UTILITY", "AUTHENTICATION" |
whatsapp_phone_number_id | string | tidak | Filter template berdasarkan WABA dari nomor telepon |
limit | number | tidak | Jumlah hasil maksimum (1-500, default 100) |
offset | number | tidak | Lewati N hasil untuk pagination (default 0) |
Gunakan endpoint ini untuk mencari name template Anda dan memastikan statusnya APPROVED sebelum mengirim. Filter dengan status=APPROVED untuk melihat template yang siap dipakai saja.
Contoh Request
- cURL
- JavaScript
- Python
curl -X GET "https://chat.api.co.id/api/v1/public/templates?status=APPROVED&limit=50" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch(
"https://chat.api.co.id/api/v1/public/templates?status=APPROVED",
{ headers: { "Authorization": "Bearer YOUR_API_KEY" } }
);
const { data, pagination } = await response.json();
const approvedTemplates = data.filter(t => t.status === "APPROVED");
import requests
response = requests.get(
"https://chat.api.co.id/api/v1/public/templates",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"status": "APPROVED", "limit": 50}
)
templates = response.json()["data"]
Response
{
"success": true,
"data": [
{
"id": "cmxxx1234567890",
"template_name": "otp_verification",
"language": "en_US",
"status": "APPROVED",
"category": "AUTHENTICATION",
"content": "{{1}} is your verification code.",
"header_type": null,
"header_content": null,
"footer_content": null,
"buttons": [
{
"type": "OTP",
"text": "Copy Code"
}
],
"variables": ["123456"],
"has_variables": true,
"created_at": "2026-04-03T09:52:02.297Z",
"updated_at": "2026-04-03T09:52:02.297Z"
}
],
"pagination": {
"total": 1,
"limit": 100,
"offset": 0,
"has_more": false
}
}
Detail Template
Ambil satu template berdasarkan ID, termasuk semua komponen, button, dan metadata.
GET /api/v1/public/templates/:templateId
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
templateId | string | ya | ID template (CUID) dari endpoint daftar |
Contoh Request
- cURL
- JavaScript
- Python
curl -X GET "https://chat.api.co.id/api/v1/public/templates/cmxxx1234567890" \
-H "Authorization: Bearer YOUR_API_KEY"
const templateId = "cmxxx1234567890";
const response = await fetch(
`https://chat.api.co.id/api/v1/public/templates/${templateId}`,
{ headers: { "Authorization": "Bearer YOUR_API_KEY" } }
);
const { data } = await response.json();
import requests
template_id = "cmxxx1234567890"
response = requests.get(
f"https://chat.api.co.id/api/v1/public/templates/{template_id}",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
template = response.json()["data"]
Response
{
"success": true,
"data": {
"id": "cmxxx1234567890",
"template_name": "promo_with_image",
"language": "id",
"status": "APPROVED",
"category": "MARKETING",
"content": "Hi {{1}}, get {{2}} off on your next purchase!",
"header_type": "IMAGE",
"header_content": "https://example.com/promo.jpg",
"footer_content": "Reply STOP to unsubscribe",
"buttons": [
{
"type": "URL",
"text": "Shop Now",
"url": "https://example.com/shop/{{1}}"
}
],
"variables": ["John", "50%"],
"has_variables": true,
"created_at": "2026-04-03T09:52:02.297Z",
"updated_at": "2026-04-03T09:52:02.297Z"
}
}
Kirim Media
Kirim file gambar, dokumen, audio, atau video.
POST /api/v1/public/messages/send
Tipe Media yang Didukung per Channel
image— JPEG, PNG (maks 5MB)document— PDF, DOC, DOCX (maks 100MB)audio— MP3, OGG (maks 16MB)video— MP4 (maks 16MB)
image— JPEG, PNGmedia_share— Bagikan media yang sudah ada
Messenger
image— JPEG, PNG, GIFvideo— MP4audio— MP3, WAVfile— Semua tipe file
Contoh
{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "image",
"media_url": "https://example.com/image.jpg",
"caption": "Check out this image!",
"whatsapp_phone_number_id": "clyyy9876543210"
}
Kirim Pesan Interaktif
Kirim pesan interaktif WhatsApp dengan button CTA URL, Reply button, atau List Menu.
POST /api/v1/public/messages/send
Khusus WhatsApp: Pesan interaktif hanya tersedia untuk channel WhatsApp dan memerlukan messaging window 24 jam yang masih aktif.
Tipe Interaktif
CTA URL Button
Kirim pesan dengan button URL yang bisa diklik. Cocok untuk mengarahkan customer ke website Anda, link pelacakan, atau resource eksternal.
Reply Button
Kirim pesan dengan maksimal 3 quick reply button. Cocok untuk survei, konfirmasi, atau memandu pilihan customer.
List Menu
Kirim pesan dengan list menu berisi hingga 10 section dan 10 item per section. Ideal untuk katalog produk, menu layanan, atau skenario apa pun yang membutuhkan pilihan terstruktur.
Contoh CTA URL Button
{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "interactive",
"whatsapp_phone_number_id": "clyyy9876543210",
"interactive": {
"type": "cta_url",
"body": {
"text": "Check out our latest products!"
},
"footer": {
"text": "Tap the button below"
},
"action": {
"name": "cta_url",
"parameters": {
"display_text": "Visit Store",
"url": "https://example.com/store"
}
}
}
}
Contoh Reply Button
{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "interactive",
"whatsapp_phone_number_id": "clyyy9876543210",
"interactive": {
"type": "button",
"body": {
"text": "How would you rate our service?"
},
"footer": {
"text": "Your feedback helps us improve"
},
"action": {
"buttons": [
{
"type": "reply",
"reply": { "id": "rating_good", "title": "Good" }
},
{
"type": "reply",
"reply": { "id": "rating_ok", "title": "Okay" }
},
{
"type": "reply",
"reply": { "id": "rating_bad", "title": "Bad" }
}
]
}
}
}
Contoh List Menu
{
"phone_number": "628123456789",
"channel": "whatsapp",
"message_type": "interactive",
"whatsapp_phone_number_id": "clyyy9876543210",
"interactive": {
"type": "list",
"body": {
"text": "Please select a service from our menu"
},
"header": {
"type": "text",
"text": "Our Services"
},
"footer": {
"text": "Tap the button to see options"
},
"action": {
"button": "View Menu",
"sections": [
{
"title": "Hair Services",
"rows": [
{
"id": "haircut",
"title": "Haircut",
"description": "Basic haircut service"
},
{
"id": "hair_coloring",
"title": "Hair Coloring",
"description": "Full hair coloring service"
}
]
},
{
"title": "Spa Services",
"rows": [
{
"id": "massage",
"title": "Massage",
"description": "60-minute relaxing massage"
},
{
"id": "facial",
"title": "Facial Treatment",
"description": "Deep cleansing facial"
}
]
}
]
}
}
}
Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
interactive.type | string | ya | "cta_url" untuk button URL, "button" untuk reply button, atau "list" untuk list menu |
interactive.body.text | string | ya | Teks utama pesan (maks 1024 karakter) |
interactive.header | object | tidak | Header opsional. Untuk tipe list: hanya teks (maks 60 karakter). Untuk tipe lain: text, image, video, atau document |
interactive.footer.text | string | tidak | Teks footer opsional (maks 60 karakter) |
interactive.action | object | ya | Konfigurasi aksi (parameter CTA URL, array button, atau section list) |
interactive.action.button | string | tidak | Untuk tipe list: teks button untuk membuka list menu (maks 20 karakter) |
interactive.action.sections | array | tidak | Untuk tipe list: array section (1-10 section) |
sections[].title | string | tidak | Judul section (maks 24 karakter) |
sections[].rows | array | ya | Array item row di dalam section (1-10 row) |
rows[].id | string | ya | Identifier unik untuk row (maks 200 karakter). Dikembalikan di webhook saat pengguna memilih item ini |
rows[].title | string | ya | Judul row yang ditampilkan ke pengguna (maks 24 karakter) |
rows[].description | string | tidak | Deskripsi row (maks 72 karakter) |
Batasan
| Elemen | Batas |
|---|---|
| Teks body | 1024 karakter |
| Teks header | 60 karakter |
| Teks footer | 60 karakter |
| Judul button | 20 karakter |
| Teks tampilan CTA | 20 karakter |
| Reply button | Maksimal 3 button |
| ID button | 256 karakter |
| Batasan List Menu | |
| Teks button list | 20 karakter |
| Section list | 1-10 section |
| Row per section | 1-10 row |
| Judul section | 24 karakter |
| ID row | 200 karakter |
| Judul row | 24 karakter |
| Deskripsi row | 72 karakter |
Indikator Mengetik
Kirim indikator mengetik ("sedang mengetik...") ke customer sebelum mengirim pesan.
POST /api/v1/public/conversations/:customerIdentifier/typing
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
customerIdentifier | string | ya | Customer ID (CUID), nomor telepon, atau username Instagram |
Request Body (Opsional)
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
channel | string | tidak | "whatsapp" atau "instagram". Terdeteksi otomatis jika tidak diisi. |
whatsapp_phone_number_id | string | tidak | ID nomor telepon WhatsApp. Tentukan nomor bisnis mana yang mengirim indikator mengetik. |
instagram_account_id | string | tidak | ID akun Instagram. Wajib jika customer punya percakapan dengan lebih dari satu akun Instagram. |
Rate Limit: Maksimal 1 request per 3 detik per customer. Jika terlampaui, API mengembalikan 429 dengan header Retry-After.
Contoh Request
- cURL (Nomor Telepon)
- cURL (Sederhana)
- JavaScript
- Python
curl -X POST "https://chat.api.co.id/api/v1/public/conversations/628123456789/typing" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"channel": "whatsapp",
"whatsapp_phone_number_id": "clyyy9876543210"
}'
curl -X POST "https://chat.api.co.id/api/v1/public/conversations/628123456789/typing" \
-H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch("https://chat.api.co.id/api/v1/public/conversations/628123456789/typing", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
channel: "whatsapp",
whatsapp_phone_number_id: "clyyy9876543210" // optional
})
});
import requests
response = requests.post(
"https://chat.api.co.id/api/v1/public/conversations/628123456789/typing",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"channel": "whatsapp",
"whatsapp_phone_number_id": "clyyy9876543210" # optional
}
)
Contoh Instagram
// Send typing to Instagram customer
POST /api/v1/public/conversations/ig_username/typing
Content-Type: application/json
{
"channel": "instagram",
"instagram_account_id": "your_ig_account_id"
}
Response
{
"success": true,
"data": {
"customer_id": "clxxx1234567890",
"channel": "whatsapp",
"typing_sent": true,
"timestamp": "2026-01-26T10:30:00.000Z"
}
}
Kode Error
| Kode | Keterangan |
|---|---|
NotFound | Customer tidak ditemukan |
WindowClosed | Messaging window 24 jam sudah berakhir |
RateLimitExceeded | Maks 1 request per 3 detik per customer |
ConfigurationError | Channel tidak tersedia untuk customer |
ConnectionError | Akun WhatsApp/Instagram terputus |
AmbiguousAccount | Customer punya lebih dari satu akun IG, isi instagram_account_id |
Tandai Sudah Dibaca
Tandai pesan sebagai sudah dibaca dan kirim read receipt ke customer.
POST /api/v1/public/messages/:messageId/read
URL Parameter
| Parameter | Tipe | Wajib | Keterangan |
|---|---|---|---|
messageId | string | ya | ID pesan (CUID) yang akan ditandai sudah dibaca |
Penting: Hanya pesan masuk (inbound) yang bisa ditandai sudah dibaca. Mencoba menandai pesan keluar (outbound) akan mengembalikan error validasi.
WhatsApp: Memerlukan WhatsApp Business Account yang terhubung. Pesan harus memiliki wamId yang valid.
Multi-Nomor: Read receipt otomatis dikirim lewat nomor WhatsApp yang sama dengan yang menerima pesan. Tidak perlu parameter tambahan.
Channel yang Didukung
- WhatsApp: Mengirim read receipt lewat WhatsApp API
- Instagram: Mengirim mark_seen lewat Instagram API
- Messenger: Tidak didukung lewat Public API
Contoh Request
- cURL
- JavaScript
- Python
curl -X POST "https://chat.api.co.id/api/v1/public/messages/msg_xyz789/read" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
const response = await fetch("https://chat.api.co.id/api/v1/public/messages/msg_xyz789/read", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
});
import requests
response = requests.post(
"https://chat.api.co.id/api/v1/public/messages/msg_xyz789/read",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
)
Response Sukses
{
"success": true,
"data": {
"message_id": "msg_xyz789",
"status": "read",
"channel": "whatsapp",
"updated_at": "2026-01-27T10:30:00.000Z"
}
}
Response Error
404 - Pesan Tidak Ditemukan
{
"error": {
"code": "NotFound",
"message": "Message not found"
}
}
400 - Error Validasi (Pesan Outbound)
{
"error": {
"code": "ValidationError",
"message": "Only inbound messages can be marked as read"
}
}
400 - Error Konfigurasi (WhatsApp Belum Terhubung)
{
"error": {
"code": "ConfigurationError",
"message": "Cannot send read receipt: missing configuration"
}
}
Coba langsung
Tekan Try it lalu tempel API key Anda (kc_live_...) ke kolom API key (Bearer). Dapatkan key dari API Keys. Request dijalankan ke akun live Anda, jadi endpoint yang mengirim, membuat, atau menghapus akan memengaruhi data sungguhan.
- POST/api/v1/public/messages/sendSend Message
- GET/api/v1/public/templatesList Templates
- POST/api/v1/public/templatesCreate Template
- POST/api/v1/public/templates/{id}/submitSubmit Template to Meta
- GET/api/v1/public/templates/{templateId}Get Template Detail
- POST/api/v1/public/conversations/{customerIdentifier}/typingTyping Indicator
- POST/api/v1/public/messages/{messageId}/readMark as Read