Lewati ke konten utama

Customer

Daftar Customer​

Ambil daftar customer dengan pagination. Mendukung filter berdasarkan kata kunci pencarian, tag, dan status blacklist.

GET /api/v1/public/customers

Query Parameter​

ParameterTipeWajibKeterangan
limitnumbertidakJumlah customer yang dikembalikan (1-200, default 50)
cursorstringtidakCustomer ID untuk pagination (dari next_cursor di response sebelumnya)
searchstringtidakCari berdasarkan nomor telepon, nama, atau email
tagsstringtidakDaftar tag yang dipisahkan koma untuk filter
blacklistedstringtidakFilter berdasarkan status blacklist: "true" atau "false"

Contoh Request​

curl -X GET "https://chat.api.co.id/api/v1/public/customers?limit=50&search=john&tags=vip,loyal" \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"success": true,
"data": [
{
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "John Doe",
"email": "[email protected]",
"tags": ["vip", "loyal"],
"is_window_active": true,
"unread_count": 3,
"created_at": "2026-01-01T00:00:00.000Z"
},
{
"id": "clxxx0987654321",
"phone_number": "628987654321",
"name": "Jane Smith",
"email": "[email protected]",
"tags": ["new"],
"is_window_active": false,
"unread_count": 0,
"created_at": "2026-02-15T08:30:00.000Z"
}
],
"pagination": {
"has_more": true,
"next_cursor": "clxxx0987654321",
"limit": 50
}
}
info

Gunakan next_cursor dari objek pagination sebagai query parameter cursor untuk mengambil halaman berikutnya.

Detail Customer​

Ambil detail lengkap satu customer, termasuk custom field, log consent, dan catatan.

GET /api/v1/public/customers/:id

URL Parameter​

ParameterTipeWajibKeterangan
idstringyaCustomer ID (CUID), nomor telepon, atau username Instagram

Contoh Request​

curl -X GET "https://chat.api.co.id/api/v1/public/customers/628123456789" \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"success": true,
"data": {
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "John Doe",
"email": "[email protected]",
"instagram_username": null,
"tags": ["vip", "loyal"],
"is_window_active": true,
"unread_count": 3,
"custom_fields": {
"company": "Acme Inc",
"plan": "enterprise"
},
"consent_logs": [
{
"source": "website_form",
"purpose": "marketing",
"consent_status": true,
"logged_at": "2026-01-01T00:00:00.000Z"
}
],
"notes": [
{
"id": "note_abc123",
"content": "VIP customer, handle with care",
"created_at": "2026-01-05T14:00:00.000Z"
}
],
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-07T10:30:00.000Z"
}
}

Buat Customer​

Buat record customer baru dengan nomor telepon, info profil, tag, dan status consent.

POST /api/v1/public/customers

Parameter​

ParameterTipeWajibKeterangan
phone_numberstringyaNomor telepon customer dalam format E.164 (mis. 628123456789)
whatsapp_phone_number_idstringyaNomor WhatsApp Anda yang akan dikaitkan dengan customer ini. Gunakan id dari GET /phone-numbers.
namestringtidakNama tampilan customer
emailstringtidakAlamat email customer
tagsstring[]tidakArray tag untuk pengelompokan (mis. ["vip", "loyal"])
consent_statusbooleantidakApakah customer sudah memberikan consent untuk dikirimi pesan
consent_sourcestringtidakSumber consent (mis. "api", "website_form", "manual")

Contoh Request​

curl -X POST "https://chat.api.co.id/api/v1/public/customers" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "628123456789",
"whatsapp_phone_number_id": "clyyy9876543210",
"name": "John Doe",
"email": "[email protected]",
"tags": ["vip"],
"consent_status": true,
"consent_source": "api"
}'

Response​

{
"success": true,
"data": {
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "John Doe",
"email": "[email protected]",
"tags": ["vip"],
"consent_status": true,
"consent_source": "api",
"blacklisted": false,
"created_at": "2026-04-03T10:00:00.000Z",
"updated_at": "2026-04-03T10:00:00.000Z"
}
}

Ubah Customer​

Ubah profil customer yang sudah ada. Hanya field yang dikirim yang diubah (partial update).

PATCH /api/v1/public/customers/:id

URL Parameter​

ParameterTipeWajibKeterangan
idstringyaCustomer ID (CUID)

Body Parameter​

ParameterTipeWajibKeterangan
namestringtidakNama customer yang baru
emailstringtidakAlamat email yang baru
tagsstring[]tidakMenggantikan semua tag yang ada dengan array ini

Contoh Request​

curl -X PATCH "https://chat.api.co.id/api/v1/public/customers/clxxx1234567890" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Name",
"tags": ["vip", "loyal"]
}'

Response​

{
"success": true,
"data": {
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "Updated Name",
"email": "[email protected]",
"tags": ["vip", "loyal"],
"consent_status": true,
"blacklisted": false,
"updated_at": "2026-04-03T11:00:00.000Z"
}
}

Hapus Customer​

Hapus record customer secara permanen. Tindakan ini tidak bisa dibatalkan.

DELETE /api/v1/public/customers/:id

URL Parameter​

ParameterTipeWajibKeterangan
idstringyaCustomer ID (CUID) yang akan dihapus
peringatan

Peringatan: Menghapus customer bersifat permanen dan juga akan menghapus seluruh riwayat percakapan, catatan, dan record consent yang terkait.

Contoh Request​

curl -X DELETE "https://chat.api.co.id/api/v1/public/customers/clxxx1234567890" \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"success": true,
"data": {
"id": "clxxx1234567890",
"deleted": true
}
}

Catat aksi consent untuk customer. Berguna untuk pelacakan GDPR/kepatuhan dan pengelolaan izin pengiriman pesan.

POST /api/v1/public/customers/:id/consent

URL Parameter​

ParameterTipeWajibKeterangan
idstringyaCustomer ID (CUID)

Body Parameter​

ParameterTipeWajibKeterangan
actionstringyaAksi consent: "OPT_IN", "OPT_OUT", atau "UPDATE"
sourcestringyaTempat consent dikumpulkan (mis. "website_form", "api", "phone_call")
purposestringtidakTujuan consent (mis. "marketing", "transactional", "support")

Contoh Request​

curl -X POST "https://chat.api.co.id/api/v1/public/customers/clxxx1234567890/consent" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "OPT_IN",
"source": "website_form",
"purpose": "marketing"
}'

Response​

{
"success": true,
"data": {
"customer_id": "clxxx1234567890",
"action": "OPT_IN",
"source": "website_form",
"purpose": "marketing",
"consent_status": true,
"logged_at": "2026-04-03T10:00:00.000Z"
}
}

Cek Messaging Window​

Cek apakah messaging window 24 jam sedang aktif untuk seorang customer. Pesan non-template hanya bisa dikirim selama window ini aktif.

GET /api/v1/public/customers/:id/window-status

peringatan

Aturan Window 24 Jam: WhatsApp hanya mengizinkan pesan bebas (teks, media, interaktif) dalam 24 jam sejak pesan masuk terakhir dari customer. Setelah window tertutup, Anda hanya bisa mengirim pesan template yang sudah disetujui. Selalu cek status window sebelum mengirim pesan non-template.

URL Parameter​

ParameterTipeWajibKeterangan
idstringyaCustomer ID (CUID), nomor telepon, atau username Instagram

Contoh Request​

curl -X GET "https://chat.api.co.id/api/v1/public/customers/628123456789/window-status" \
-H "Authorization: Bearer YOUR_API_KEY"

Response​

{
"success": true,
"data": {
"customer_id": "clxxx1234567890",
"whatsapp": {
"is_window_active": true,
"window_expires_at": "2026-01-08T10:30:00.000Z",
"last_inbound_message_at": "2026-01-07T10:30:00.000Z",
"can_send_freeform": true,
"can_send_template": true,
"free_entry_point": {
"is_active": true,
"expires_at": "2026-01-14T10:30:00.000Z"
},
"is_free": true,
"free_reason": "ctwa",
"free_service_messages": {
"limit": 1000,
"used": 312,
"remaining": 688
}
},
"instagram": {
"is_window_active": false,
"window_expires_at": null
}
}
}

Free Window Click-to-WhatsApp​

whatsapp.free_entry_point menunjukkan apakah customer sedang berada di free entry point window dari iklan Click-to-WhatsApp. Sejak Oktober 2026 window ini berlaku hingga 7 hari, dan semua pesan yang dikirim ke customer selama window ini gratis, termasuk template. Window terbuka saat customer mengirim pesan dari iklan. Pesan yang dikirim di dalam window ini tidak dihitung ke 1.000 pesan layanan gratis. expires_at bernilai null jika customer tidak pernah datang dari iklan.

info

Ini estimasi: kami memulai window dari pesan iklan, sedangkan Meta memulainya dari balasan pertama Anda (dalam 24 jam). Invoice Meta Anda adalah angka final.

Apakah Pesan Berikutnya Gratis?​

whatsapp.is_free menunjukkan apakah pesan berikutnya ke customer ini gratis. free_reason menjelaskan alasannya:

  • "ctwa": customer sedang berada di free window Click-to-WhatsApp. Semua pesan gratis, termasuk template.
  • "free_tier": window 24 jam terbuka dan nomor telepon customer masih punya sisa pesan layanan gratis bulan ini. Pesan bebas gratis. Template tetap berbayar.
  • null: pesan berikutnya berbayar, atau window tertutup dan Anda hanya bisa mengirim template.

free_service_messages menunjukkan jumlah 1.000 pesan layanan gratis yang terpakai dan tersisa bulan ini (UTC) pada nomor telepon yang terhubung ke customer. Bernilai null jika customer tidak punya nomor yang terhubung. Angka ini juga estimasi.

Atur Blacklist​

Tambahkan atau hapus customer dari blacklist. Customer yang di-blacklist tidak akan menerima pesan apa pun.

PATCH /api/v1/public/customers/:id/blacklist

URL Parameter​

ParameterTipeWajibKeterangan
idstringyaCustomer ID (CUID), nomor telepon, atau username Instagram

Body Parameter​

ParameterTipeWajibKeterangan
blacklistedbooleanyaIsi true untuk blacklist, false untuk menghapus dari blacklist

Contoh Request​

curl -X PATCH "https://chat.api.co.id/api/v1/public/customers/628123456789/blacklist" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"blacklisted": true}'

Response​

{
"success": true,
"data": {
"id": "clxxx1234567890",
"phone_number": "628123456789",
"name": "John Doe",
"blacklisted": true,
"updated_at": "2026-04-03T10:00:00.000Z"
}
}

Catatan Customer​

Kelola catatan internal yang terkait dengan customer. Catatan hanya terlihat oleh tim Anda.

GET /api/v1/public/customers/:id/notes

POST /api/v1/public/customers/:id/notes

DELETE /api/v1/public/customers/:id/notes/:noteId

URL Parameter​

ParameterTipeWajibKeterangan
idstringyaCustomer ID (CUID), nomor telepon, atau username Instagram
noteIdstringyaID catatan (hanya wajib untuk DELETE)

Body Parameter (POST)​

ParameterTipeWajibKeterangan
contentstringyaIsi teks catatan

Daftar Catatan​

curl -X GET "https://chat.api.co.id/api/v1/public/customers/628123456789/notes" \
-H "Authorization: Bearer YOUR_API_KEY"

Response Daftar Catatan​

{
"success": true,
"data": [
{
"id": "note_abc123",
"content": "VIP customer, handle with care",
"created_by": "[email protected]",
"created_at": "2026-01-05T14:00:00.000Z"
},
{
"id": "note_def456",
"content": "Prefers communication in English",
"created_by": "[email protected]",
"created_at": "2026-02-10T09:15:00.000Z"
}
]
}

Tambah Catatan​

curl -X POST "https://chat.api.co.id/api/v1/public/customers/628123456789/notes" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "Follow up on order #1234"}'

Response Tambah Catatan​

{
"success": true,
"data": {
"id": "note_ghi789",
"content": "Follow up on order #1234",
"created_by": "[email protected]",
"created_at": "2026-04-03T10:00:00.000Z"
}
}

Hapus Catatan​

curl -X DELETE "https://chat.api.co.id/api/v1/public/customers/628123456789/notes/note_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"

Response Hapus Catatan​

{
"success": true,
"message": "Note deleted successfully"
}

Coba langsung​

tip

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.

  • GET/api/v1/public/customersList Customers
  • POST/api/v1/public/customersCreate Customer
  • GET/api/v1/public/customers/{id}Get Customer
  • PATCH/api/v1/public/customers/{id}Update Customer
  • DELETE/api/v1/public/customers/{id}Delete Customer
  • POST/api/v1/public/customers/{id}/consentCustomer Consent
  • GET/api/v1/public/customers/{id}/window-statusCheck Messaging Window
  • PATCH/api/v1/public/customers/{id}/blacklistToggle Blacklist
  • GET/api/v1/public/customers/{id}/notesList Notes
  • POST/api/v1/public/customers/{id}/notesAdd Note
  • DELETE/api/v1/public/customers/{id}/notes/{noteId}Delete Note
Apakah halaman ini membantu?