Endpoint untuk menerima dan membaca pesan masuk. callback_message adalah webhook yang dipanggil WA gateway; sisanya dipanggil frontend.
POST /v1/callback_message
Webhook yang dipanggil WhatsApp gateway :5002 saat pesan masuk atau status berubah. Skip auth (excluded path).
Handler: handlers/chat_callback.go:89 CallbackMessage
Payload: shared Payload struct (handlers/chat.go:22-72)
Branching: handler punya 2 path berdasarkan Result + Report:
Result | Report | Path |
|---|---|---|
true | false | New message — proses pesan masuk |
true | true | Status update — update status_ack |
false | (any) | Reject — {"result": false, "message": "Callback result false"} |
Request body (new message path)
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
instanceID | string | ✅ | Device instance ID |
result | bool | ✅ | Harus true |
report | bool | ✅ | false untuk new message |
text | string | ❌ | Konten pesan (text) |
number | string | ✅ | Nomor pengirim (62812...@s.whatsapp.net / ...@g.us) |
fromMe | bool | ❌ | Apakah pesan dari device sendiri |
id | string | ❌ | Pesan ID WA |
name | string | ❌ | Nama pengirim |
timestamp | int64 | ❌ | Timestamp WA |
type | string | ❌ | Jenis pesan (chat/image/video/document/audio/extendedtext) |
latitude | string | ❌ | Lat (untuk location) |
longitude | string | ❌ | Lng (untuk location) |
caption | string | ❌ | Caption media |
matchedText | string | ❌ | Text match (link preview) |
quoteMsg | string | ❌ | Pesan yang di-quote |
profilepic | string | ❌ | URL foto profil |
participantname | string | ❌ | Nama participant (group) |
rawMessage | string | ❌ | Raw message blob |
locationAddress | string | ❌ | Alamat lokasi |
locationName | string | ❌ | Nama lokasi |
Response (new message, sukses)
{
"result": true,
"data": {
"newChatInbox": { /* ChatInboxStruct */ },
"chat_list": { /* ChatListStruct */ },
"chat_order": { /* ChatOrderStruct */ },
"handle_gudang": { /* HandleGudangStruct */ },
"customer": { /* CustomerStruct */ },
"history": { /* ChatHistoryStruct */ }
}
}Response (new message, error)
{"result": false, "message": "<err>"}Request body (status update path)
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
number | string | ✅ | Nomor pengirim |
instanceID | string | ✅ | Device instance |
id | string | ✅ | Pesan ID |
status | string | ✅ | Status baru: sent/delivered/viewed/played |
result | bool | ✅ | Harus true |
report | bool | ✅ | Harus true |
Response (status update, sukses)
{"result": true, "message": "updated status"}Response (status update, error)
| Kondisi | Body |
|---|---|
| Field wajib kosong | {"result": false, "message": "missing required fields"} |
| Format nomor invalid | {"result": false, "message": "invalid number format"} |
| Status tidak valid | {"result": false, "message": "message update not valid"} |
| Update gagal | {"result": false, "message": "<err>"} |
| BodyParser gagal | 400 {"error": "<err>"} |
POST /v1/chat_inbox
Ambil inbox pesan untuk satu percakapan.
Handler: handlers/chat_live.go:216 GetInbox
Auth: JWT wajib
Request body
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
nohp | string | ✅ | Nomor customer |
instance | string | ✅ | Device instance |
team | string | ✅ | Team ID |
limit | string | ❌ | Jumlah pesan |
offset | string | ❌ | Offset pagination |
customerId | string | ❌ | Customer ID filter |
Response (sukses)
{
"result": true,
"data": [/* ChatInboxStruct[] */],
"chat_list": {/* ChatListStruct */},
"chat_order": {/* ChatOrderStruct */},
"customer": {/* CustomerStruct */},
"chat_device": {/* DeviceStruct */},
"handle_gudang": {/* HandleGudangStruct */},
"history": {/* ChatHistoryStruct */}
}Response (error)
{"result": false, "message": "<err>"}Error sources: GetTeam, GetDevice, GetChatInbox, GetChatlistBynohp.
POST /v1/chat_inbox_position
Ambil posisi (offset) pesan tertentu dalam inbox.
Handler: handlers/chat_live.go:425 GetMessagePosition
Request body
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
pesan_id | string | ✅ | Pesan ID target |
nohp | string | ✅ | Nomor customer |
instance | string | ✅ | Device instance |
Response (sukses)
{
"result": true,
"offset": 42,
"waktu": "2024-01-15 10:30"
}Response (error)
| Kondisi | Body |
|---|---|
| BodyParser gagal | {"result": false, "message": "<err>"} |
| Pesan tidak ditemukan | {"result": false, "message": "pesan tidak ditemukan"} |
| Count gagal | {"result": false, "message": "<err>"} |
POST /v1/chat_list
Ambil daftar percakapan (chat list).
Handler: handlers/chat_live.go:488 GetListChat
Request body
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
nohp | string | ✅ | (tidak dipakai langsung, tapi wajib di struct) |
instance | string | ✅ | Device instance |
team | string | ✅ | Team ID |
not_group | *string | ❌ | Filter group chat ("true" = exclude group) |
keyword | string | ❌ | Search keyword |
status | string | ❌ | Filter status chat |
search | string | ❌ | Search term |
searchType | string | ❌ | Search type |
filter | object | ❌ | Filter data kompleks |
Response (sukses)
{
"result": true,
"data": [/* ChatListStruct[] */],
"indexlist": ["id1", "id2"]
}Response (error)
{"result": false, "message": "<err>"}Error sources: GetTeam, GetChatList, GetChatlistOrderAttrsBatch.
POST /v1/chat_markread
Tandai pesan sebagai sudah dibaca.
Handler: handlers/chat_live.go:1369 MarkAsReadMessage
Request body
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
nohp | string | ✅ | Nomor customer |
instance | string | ✅ | Device instance |
team | string | ✅ | Team ID |
Response (sukses)
{"result": true, "message": "success mark as read"}Response (error)
{"result": false, "message": "<err>"}POST /v1/chat_newinbox
Ambil pesan baru untuk percakapan (mirip chat_inbox tapi untuk pesan yang belum dilihat).
Handler: handlers/chat_live.go:114 GetNewMessage
Request body
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
chatId | string | ❌ | Chat ID spesifik |
nohp | string | ✅ | Nomor customer |
instance | string | ✅ | Device instance |
team | string | ✅ | Team ID |
customerId | string | ❌ | Customer ID |
Response (sukses)
Shape sama dengan chat_inbox — 8 key (result, data, chat_list, chat_order, customer, chat_device, handle_gudang, history).
Response (error)
{"result": false, "message": "<err>"}Error sources: GetTeam, GetDevice, GetSingleChatInbox, customer fetch, GetChatlistBynohp, history fetch.
POST /v1/chat_inboxdetail
Ambil detail satu pesan inbox.
Handler: handlers/chat_live.go:403 GetInboxDetail
Request body
| Field | Tipe | Wajib | Deskripsi |
|---|---|---|---|
chatInboxId | string | ✅ | ChatInbox ID |
Response (sukses)
{
"result": true,
"data": {/* ChatInboxStruct */}
}Response (error)
{"result": false, "message": "<err>"}Kembali ke
- API Reference Index — daftar semua grup
- Chat Lifecycle — finish/pending/move chat
- Send Outbound — kirim pesan keluar