Plugin Hermes Agent untuk WhatsApp via Kirimdev Cloud API.
Customer WhatsApp → Kirimdev → POST /webhook → Hermes Agent → Kirimdev Public API
Versi plugin: kirimdev-platform/plugin.yaml · Changelog: CHANGELOG.md
- Arsitektur
- Quick start (local)
- Konfigurasi environment
- Authorization tier
- Panduan deploy production
- Webhook Kirimdev
- Fitur inbound (v1.1+)
- Verifikasi & troubleshooting
- Development & testing
- Struktur repo
Customer WhatsApp
│
▼
Kirimdev Cloud API
│ POST /webhook (X-Kirim-Signature)
▼
nginx :443 ──proxy──► Hermes plugin :8646 ──► Hermes Agent (LLM)
▲ │
│ └── POST /v1/{phone_number_id}/messages
└── Let's Encrypt (certbot)
- Port 8646 hanya localhost — di-proxy nginx, jangan expose langsung.
- Session key Hermes:
{phone_number_id}:{customer_phone}(satu chat per nomor bisnis). - Hanya nomor di
KIRIMDEV_ENABLED_NUMBERSyang dioperasikan agent; nomor lain tetap jalan di dashboard Kirimdev.
Prasyarat: Hermes v0.14+, akun Kirimdev, nomor WA Cloud API terhubung.
git clone https://github.com/kirimdev/kirimdev-hermes.git
cp -r kirimdev-hermes/kirimdev-platform ~/.hermes/plugins/kirimdev-platform
hermes plugins enable kirimdev-platform
pip install aiohttp httpx # di env Hermes
hermes config set KIRIMDEV_API_KEY kdv_live_xxx
hermes config set KIRIMDEV_ENABLED_NUMBERS <phone_number_id>
hermes config set KIRIMDEV_DEFAULT_PHONE_NUMBER_ID <phone_number_id>
hermes config set KIRIMDEV_OWNER_USERS 628123456789
hermes config set KIRIMDEV_WEBHOOK_SECRETS whsec_xxx
hermes gateway restart
curl -s http://127.0.0.1:8646/health
# {"status":"ok","platform":"kirimdev","channel":"whatsapp"}Template env: .env.example
Set via hermes config set NAMA nilai (disimpan di ~/.hermes/.env).
Nomor telepon: digits saja, tanpa
+— contoh628123456789.
phone_number_id: Meta business phone number ID dari Kirimdev (Settings → nomor WA), bukan nomor telepon bisnis.
| Variable | Contoh | Deskripsi |
|---|---|---|
KIRIMDEV_API_KEY |
kdv_live_… |
API key dari Dashboard → API Keys |
KIRIMDEV_WEBHOOK_SECRETS |
whsec_… |
Secret dari webhook subscription. Comma-separated saat rotasi. Alias: KIRIMDEV_WEBHOOK_SECRET |
KIRIMDEV_ENABLED_NUMBERS |
123456789012345 |
Comma-separated phone_number_id yang dioperasikan agent |
| Variable | Deskripsi |
|---|---|
KIRIMDEV_DEFAULT_PHONE_NUMBER_ID |
Default sender untuk cron / CLI (biasanya sama dengan entry di ENABLED_NUMBERS) |
KIRIMDEV_PUBLIC_URL |
https://domain tanpa /webhook |
KIRIMDEV_OWNER_USERS |
Nomor owner (comma-separated) — full access + approve customer baru |
| Variable | Default | Deskripsi |
|---|---|---|
KIRIMDEV_ALLOWED_USERS |
(kosong) | Whitelist customer tier allowed |
KIRIMDEV_ALLOW_ALL_USERS |
false |
Dev only — tidak bypass approval tier |
KIRIMDEV_OWNER_FULL_AGENT |
true |
false = owner hanya tools kirimdev_*, tanpa terminal/web Hermes |
| Variable | Default | Deskripsi |
|---|---|---|
KIRIMDEV_HOST |
0.0.0.0 |
Bind address |
KIRIMDEV_PORT |
8646 |
Port lokal webhook server |
KIRIMDEV_RATE_LIMIT_PER_MIN |
15 |
Cap inbound per customer |
Pause agent saat staff kirim dari dashboard Kirimdev atau echo app HP.
| Variable | Default | Deskripsi |
|---|---|---|
KIRIMDEV_HUMAN_HANDOFF_SECONDS |
900 |
Durasi pause (detik). 0 = off. Butuh webhook message.sent |
| Variable | Default | Deskripsi |
|---|---|---|
KIRIMDEV_VOICE_TRANSCRIBE |
false |
true = transkrip Whisper dari kirim.media_url |
OPENAI_API_KEY |
— | Wajib jika voice transcribe aktif |
| Variable | Default | Deskripsi |
|---|---|---|
KIRIMDEV_API_BASE_URL |
https://api.kirimdev.com/v1 |
Dev lokal: http://localhost:3000/v1 |
KIRIMDEV_DEFAULT_CHANNEL |
whatsapp |
Saat ini hanya whatsapp |
KIRIMDEV_HOME_CHANNEL |
— | Target cron: {phone_number_id}:{customer} atau digits saja |
| Variable | Default |
|---|---|
KIRIMDEV_GRANTS_FILE |
~/.hermes/kirimdev_grants.json |
KIRIMDEV_PENDING_FILE |
~/.hermes/kirimdev_pending.json |
| Variable | Deskripsi |
|---|---|
INSECURE_NO_AUTH |
Set sebagai nilai di KIRIMDEV_WEBHOOK_SECRETS untuk skip signature — jangan production |
# Minimal production
hermes config set KIRIMDEV_API_KEY kdv_live_xxxxxxxx
hermes config set KIRIMDEV_ENABLED_NUMBERS 123456789012345
hermes config set KIRIMDEV_DEFAULT_PHONE_NUMBER_ID 123456789012345
hermes config set KIRIMDEV_OWNER_USERS 628123456789
hermes config set KIRIMDEV_PUBLIC_URL https://hermes-webhooks.domain.com
hermes config set KIRIMDEV_WEBHOOK_SECRETS whsec_xxxxxxxx
# Opsional v1.1+
hermes config set KIRIMDEV_HUMAN_HANDOFF_SECONDS 900
hermes config set KIRIMDEV_VOICE_TRANSCRIBE true
hermes config set OPENAI_API_KEY sk-...| Tier | Sumber | Agent auto-reply? | Tools |
|---|---|---|---|
owner |
KIRIMDEV_OWNER_USERS |
✅ | Full Hermes + kirimdev_* |
allowed |
KIRIMDEV_ALLOWED_USERS |
✅ | Text + reply (button, list, image, …) |
granted |
Owner tap Approve di WA | ✅ (24 jam) | Text only |
unknown |
Lainnya | ❌ pending approval | — |
Customer baru (unknown) → owner dapat WA dengan tombol Approve/Deny.
Testing pertama: masukkan nomor WA kamu ke KIRIMDEV_OWNER_USERS, kirim pesan ke nomor bisnis → agent harus balas.
Contoh domain: hermes-webhooks.domain.com
Webhook URL: https://hermes-webhooks.domain.com/webhook
| Item | Keterangan |
|---|---|
| VPS | Ubuntu 22.04+ |
| Domain | Subdomain + A record → IP VPS |
| Kirimdev | Akun + nomor WA Cloud API |
| Hermes | v0.14+ + LLM provider configured |
phone_number_id |
Dari Kirimdev Settings → nomor WA |
which hermes && hermes --version && hermes doctorSetup LLM (hermes login, ~/.hermes/.env, dll.).
git clone https://github.com/kirimdev/kirimdev-hermes.git
cp -r kirimdev-hermes/kirimdev-platform ~/.hermes/plugins/kirimdev-platform
hermes plugins enable kirimdev-platform
~/.hermes/hermes-agent/venv/bin/pip install aiohttp httpxLihat Konfigurasi environment. Webhook secret diisi setelah Step 9.
| Type | Name | Content |
|---|---|---|
| A | hermes-webhooks |
IP VPS |
dig @8.8.8.8 hermes-webhooks.domain.com +shortHarus resolve sebelum daftar webhook Kirimdev.
sudo apt install -y nginx
sudo ufw allow 'Nginx Full'
sudo nano /etc/nginx/sites-available/hermes-webhookserver {
listen 80;
listen [::]:80;
server_name hermes-webhooks.domain.com;
location /.well-known/acme-challenge/ {
root /var/www/html;
}
location /webhook {
proxy_pass http://127.0.0.1:8646/webhook;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 1m;
proxy_read_timeout 30s;
proxy_send_timeout 30s;
}
location /health {
proxy_pass http://127.0.0.1:8646/health;
proxy_set_header Host $host;
access_log off;
}
location / {
return 444;
}
}sudo ln -sf /etc/nginx/sites-available/hermes-webhook /etc/nginx/sites-enabled/
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl reload nginxJangan tambah block
listen 443manual — certbot yang menambah HTTPS (Step 7).
hermes gateway restart
curl -s http://127.0.0.1:8646/healthsudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d hermes-webhooks.domain.com
curl -s https://hermes-webhooks.domain.com/health
curl https://domain/→ Empty reply normal. Test/healthatau/webhook.
which hermes
mkdir -p ~/.config/systemd/user
cp deploy/hermes-gateway.service ~/.config/systemd/user/
# Edit ExecStart = path dari `which hermes`
loginctl enable-linger $USER
systemctl --user daemon-reload
systemctl --user enable --now hermes-gateway
tail -f ~/.hermes/gateway.logSubscribe message.received dan message.sent (wajib v1.1+ untuk handoff + echo guard).
export KIRIMDEV_API_KEY=kdv_live_xxx
curl -s -X POST https://api.kirimdev.com/v1/webhook_subscriptions \
-H "Authorization: Bearer $KIRIMDEV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://hermes-webhooks.domain.com/webhook",
"events": ["message.received", "message.sent"]
}'Simpan initial_secret → hermes config set KIRIMDEV_WEBHOOK_SECRETS whsec_xxx → restart gateway.
Atau via Kirimdev Dashboard → Settings → Webhooks.
Lihat Authorization tier. Set minimal KIRIMDEV_OWNER_USERS.
curl -s https://hermes-webhooks.domain.com/health
hermes plugins list
hermes config get KIRIMDEV_ENABLED_NUMBERS
tail -f ~/.hermes/gateway.log | grep -i kirimdevLog sukses: Kirimdev inbound: pid=... phone=628xxx ...
| Mode | Catatan |
|---|---|
| Full (strict) | Recommended setelah certbot |
| Flexible | CF→origin HTTP — pastikan nginx :80 aktif |
hermes send --to kirimdev:123456789012345:628123456789 "Halo dari Hermes"| URL | Fungsi |
|---|---|
https://<domain>/webhook |
Daftar di Kirimdev subscription |
https://<domain>/health |
Health check publik |
http://127.0.0.1:8646 |
Backend internal (jangan expose) |
| Event | Fungsi |
|---|---|
message.received |
Pesan masuk customer → agent |
message.sent |
Echo guard + human handoff (dashboard/app) |
Header verifikasi: X-Kirim-Signature: t=<ts>,v1=<hex>
| Tipe | Perilaku |
|---|---|
| Teks | Standar |
| Interactive / button reply | Title/id diteruskan sebagai teks ke agent |
| Gambar | Caption + kirim.media_url saat media_status=ready |
| Audio / voice | Transkrip opsional (KIRIMDEV_VOICE_TRANSCRIBE + OPENAI_API_KEY) |
Tools outbound (kirimdev_*): send text, buttons, list, image, template, broadcast, dll. — tier-gated.
| Gejala | Fix |
|---|---|
ENOTFOUND buat webhook |
DNS belum resolve — cek A record |
curl :8646/health kosong |
hermes plugins enable kirimdev-platform, set API key + secret |
| 401 webhook | KIRIMDEV_WEBHOOK_SECRETS salah |
| Pesan masuk, tidak balas | Tier unknown — set KIRIMDEV_OWNER_USERS atau ALLOWED_USERS |
phone_number_id not enabled |
Cek KIRIMDEV_ENABLED_NUMBERS |
| Agent balas padahal staff sudah chat di dashboard | Subscribe message.sent; cek KIRIMDEV_HUMAN_HANDOFF_SECONDS |
| Voice tidak diproses | KIRIMDEV_VOICE_TRANSCRIBE=true + OPENAI_API_KEY |
| 502 nginx | systemctl --user restart hermes-gateway |
| Gateway restart loop | which hermes → update ExecStart di systemd unit |
hermes plugin enable error |
Pakai hermes plugins enable (jamak) |
cd kirimdev-platform
pip install aiohttp httpx pytest
python -m pytest tests/ -vAPI Kirimdev lokal:
hermes config set KIRIMDEV_API_BASE_URL http://localhost:3000/v1kirimdev-platform/ # Source plugin Hermes
adapter.py # Webhook + dispatch
tools.py # kirimdev_* tools
meta.py # Signature + payload parse
plugin.yaml # Manifest (env schema untuk hermes setup)
tests/
deploy/
hermes-gateway.service # systemd user unit template
.env.example # Template konfigurasi
CHANGELOG.md
MIT — LICENSE