Adds `whatsapp_agent`, an additive channel that connects nanobot to the official WhatsApp Agent Platform API (https://api.whatsapp.com/agent/v1). It authenticates with a per-agent API token and long-polls `GET /updates` instead of linking a device, so it is the officially supported interface rather than the Neonize linked-device protocol used by the existing `whatsapp` channel. The existing `whatsapp` channel is unchanged; both can run at once under different names. Design notes: - The poll cursor, dedup window, and creator identifier live in one atomically replaced state file. A message id is recorded before it is handled, so a crash re-reads the batch without answering twice, and the cursor is only accepted after the batch is processed. - The first poll omits `offset`, which resolves the head and never replays up to 30 days of history into an auto-replying agent. - A changed token resets the cursor, because `next_offset` is only valid for the agent that issued it. - Each API method is paced below its own rolling 60-second limit, and progress/tool-hint messages default to off because they spend the shared 12-per-minute send budget. - Retries are limited to confirmed non-delivery (`429`, `503`/`131016`). A `500` or read timeout is ambiguous, so it is not retried unless `retryAmbiguousSends` is set; a duplicate is worse than a missed reply. - Inbound media is downloaded through the shared SSRF guard, size-capped, and verified against the reported digest. Outbound media is validated before upload. - Reactions are receive-only, matching the API. The token is never logged or persisted; state stores only a SHA-256 fingerprint. Docs compare both WhatsApp channels, including the lack of end-to-end encryption, country availability, and rate limits.
80 lines
2.2 KiB
JSON
80 lines
2.2 KiB
JSON
{
|
|
"setup": {
|
|
"docsLabel": "Buka panduan penyiapan agen",
|
|
"officialLabel": "Buka bantuan agen WhatsApp",
|
|
"summary": "Hubungkan nanobot sebagai agen pihak ketiga resmi di akun WhatsApp Anda sendiri. Hanya Anda yang dapat mengobrol dengannya, dan ia tidak mengakses obrolan lain Anda.",
|
|
"fields": {
|
|
"token": {
|
|
"label": "Token API",
|
|
"placeholder": "Di WhatsApp, buka Setelan → Agen, buat agen, lalu salin kunci dari obrolan agen → Info obrolan → Kunci API.",
|
|
"help": "Di WhatsApp, buka Setelan → Agen, buat agen, lalu salin kunci dari obrolan agen → Info obrolan → Kunci API."
|
|
},
|
|
"allowFrom": {
|
|
"label": "Pengirim yang diizinkan",
|
|
"placeholder": "user:1234567890"
|
|
},
|
|
"stateDir": {
|
|
"label": "Direktori status",
|
|
"placeholder": "~/.nanobot/whatsapp-agent"
|
|
},
|
|
"pollTimeout": {
|
|
"label": "Batas waktu polling (detik)",
|
|
"placeholder": "25"
|
|
},
|
|
"maxMediaMb": {
|
|
"label": "Ukuran media maksimum (MB)",
|
|
"placeholder": "16"
|
|
},
|
|
"markRead": {
|
|
"label": "Kirim tanda dibaca",
|
|
"choices": {
|
|
"true": "Aktif",
|
|
"false": "Nonaktif"
|
|
}
|
|
},
|
|
"typingIndicator": {
|
|
"label": "Tampilkan indikator mengetik",
|
|
"choices": {
|
|
"true": "Aktif",
|
|
"false": "Nonaktif"
|
|
}
|
|
},
|
|
"downloadMedia": {
|
|
"label": "Unduh media masuk",
|
|
"choices": {
|
|
"true": "Aktif",
|
|
"false": "Nonaktif"
|
|
}
|
|
},
|
|
"deleteMediaAfterDownload": {
|
|
"label": "Hapus media setelah unduh",
|
|
"choices": {
|
|
"true": "Aktif",
|
|
"false": "Nonaktif"
|
|
}
|
|
},
|
|
"retryAmbiguousSends": {
|
|
"label": "Coba ulang kirim yang tidak pasti",
|
|
"choices": {
|
|
"true": "Aktif",
|
|
"false": "Nonaktif"
|
|
}
|
|
},
|
|
"sendProgress": {
|
|
"label": "Kirim pesan kemajuan",
|
|
"choices": {
|
|
"true": "Aktif",
|
|
"false": "Nonaktif"
|
|
}
|
|
},
|
|
"sendToolHints": {
|
|
"label": "Kirim petunjuk alat",
|
|
"choices": {
|
|
"true": "Aktif",
|
|
"false": "Nonaktif"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|