الأكاديمية ← قنوات المراسلةتوثيق رسمي · إرشاد عربي

قناة WhatsApp

WhatsApp

متوسط10 دقائق قراءةالدرس 75 أسئلة✓ 2026-08-18
قبل أن تقرأ

ما هذه الصفحة، وماذا تحتوي.

بوابة المراسلة: الوصلة التي تجعلك تكلّم Hermes من تطبيق تستعمله أصلًا، مثل Telegram أو WhatsApp، بدل الطرفية. الوكيل الذي تصله من هاتفك تستعمله فعلًا. الذي يحتاج فتح الحاسوب تنساه بعد أسبوع. الصفحة فيها تحذير من المصدر، و10 دقائق قراءة. انتبه: افتح القناة لنفسك فقط في البداية عبر قائمة سماح. القناة المفتوحة تعني أن أي شخص يراسل وكيلك.

11أقسام
8أمثلة برمجية
4جداول
4أوامر
1,740كلمة من المصدر
الوصف الرسمي في سطر

Set up Hermes Agent as a WhatsApp bot via the built-in Baileys bridge

ماذا ستستطيع بعدها

نتائج مأخوذة من هذه الصفحة، لا من قالب.

  • تعرف ما بوابة المراسلة ولماذا قد تحتاجه.
  • تنفّذ hermes whatsapp وhermes gateway install وتفهم ما يحدث بعدها.
  • تقرأ الجدول وتأخذ منه السطر الذي يخصّك فقط.
  • تضبط WHATSAPP_ENABLED في المكان الصحيح.
ما ستقابله من أسماء

كما تظهر تمامًا داخل Hermes.

الأوامر
  • hermes whatsapp
  • hermes gateway install
  • hermes gateway
  • hermes gateway setup
متغيرات البيئة
  • WHATSAPP_ENABLED
  • WHATSAPP_MODE
  • WHATSAPP_ALLOWED_USERS
  • WHATSAPP_ALLOW_ALL_USERS
  • GROQ_API_KEY
  • VOICE_TOOLS_OPENAI_KEY
خريطة الصفحة

انتقل مباشرة إلى ما تحتاجه.

  1. 01Two Modes
  2. 02Prerequisites
  3. 03Step 1: Run the Setup Wizard
  4. 04Step 2: Getting a Second Phone Number (Bot Mode)
  5. 05Step 3: Configure Hermes
  6. 06Session Persistence
  7. 07Re-pairing
  8. 08Voice Messages
  9. 09Message Formatting & Delivery
  10. 10Troubleshooting
  11. 11Security
الصفحة الرسمية كاملة

بلا اختصار أو حذف.

النص أدناه منقول من المصدر الرسمي بالإنجليزية حتى تبقى الأوامر والأسماء دقيقة كما هي. قبل كل قسم شرح عربي يوضّح ما بداخله.

Hermes connects to WhatsApp through a built-in bridge based on Baileys. This works by emulating a WhatsApp Web session — not through the official WhatsApp Business API. No Meta developer account or Business verification is required.

Run hermes gateway setup and pick WhatsApp for a guided walk-through.

Two Modes

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه. تذكير: الوصلة التي تجعلك تكلّم Hermes من تطبيق تستعمله أصلًا، مثل Telegram أو WhatsApp، بدل الطرفية.

ModeHow it worksBest for
Separate bot number (recommended)Dedicate a phone number to the bot. People message that number directly.Clean UX, multiple users, lower ban risk
Personal self-chatUse your own WhatsApp. You message yourself to talk to the agent.Quick setup, single user, testing

---

Prerequisites

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

  • Node.js v18+ and npm — the WhatsApp bridge runs as a Node.js process
  • A phone with WhatsApp installed (for scanning the QR code)

Unlike older browser-driven bridges, the current Baileys-based bridge does not require a local Chromium or Puppeteer dependency stack.

---

Step 1: Run the Setup Wizard

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes whatsapp.

Shellسطر واحد
hermes whatsapp

The wizard will:

  1. Ask which mode you want (bot or self-chat)
  2. Install bridge dependencies if needed
  3. Display a QR code in your terminal
  4. Wait for you to scan it

To scan the QR code:

  1. Open WhatsApp on your phone
  2. Go to Settings → Linked Devices
  3. Tap Link a Device
  4. Point your camera at the terminal QR code

Once paired, the wizard confirms the connection and exits. Your session is saved automatically.

---

Step 2: Getting a Second Phone Number (Bot Mode)

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes whatsapp.

For bot mode, you need a phone number that isn't already registered with WhatsApp. Three options:

OptionCostNotes
Google VoiceFreeUS only. Get a number at voice.google.com ↗. Verify WhatsApp via SMS through the Google Voice app.
Prepaid SIM$5–15 one-timeAny carrier. Activate, verify WhatsApp, then the SIM can sit in a drawer. Number must stay active (make a call every 90 days).
VoIP servicesFree–$5/monthTextNow, TextFree, or similar. Some VoIP numbers are blocked by WhatsApp — try a few if the first doesn't work.

After getting the number:

  1. Install WhatsApp on a phone (or use WhatsApp Business app with dual-SIM)
  2. Register the new number with WhatsApp
  3. Run hermes whatsapp and scan the QR code from that WhatsApp account

---

Step 3: Configure Hermes

خطوات عملية بالترتيب. نفّذ خطوة وتأكد أنها نجحت قبل الانتقال للتالية. الأوامر هنا: hermes gateway، hermes gateway install.

Add the following to your ~/.hermes/.env file:

Shell8 أسطر
# Required
WHATSAPP_ENABLED=true
WHATSAPP_MODE=bot                          # "bot" or "self-chat"

# Access control — pick ONE of these options:
WHATSAPP_ALLOWED_USERS=15551234567         # Comma-separated phone numbers (with country code, no +)
# WHATSAPP_ALLOWED_USERS=*                 # OR use * to allow everyone
# WHATSAPP_ALLOW_ALL_USERS=true            # OR set this flag instead (same effect as *)

Optional behavior settings in ~/.hermes/config.yaml:

YAML4 أسطر
unauthorized_dm_behavior: pair

whatsapp:
  unauthorized_dm_behavior: ignore
  • unauthorized_dm_behavior: pair is the global default. Unknown DM senders get a pairing code.
  • whatsapp.unauthorized_dm_behavior: ignore makes WhatsApp stay silent for unauthorized DMs, which is usually the better choice for a private number.

Then start the gateway:

Shell3 أسطر
hermes gateway              # Foreground
hermes gateway install      # Install as a user service
sudo hermes gateway install --system   # Linux only: boot-time system service

The gateway starts the WhatsApp bridge automatically using the saved session.

---

Session Persistence

شرح للفكرة نفسها. اقرأه ببطء، فبقية الأقسام تبني عليه.

The Baileys bridge saves its session under ~/.hermes/platforms/whatsapp/session. This means:

  • Sessions survive restarts — you don't need to re-scan the QR code every time
  • The session data includes encryption keys and device credentials
  • Do not share or commit this session directory — it grants full access to the WhatsApp account

---

Re-pairing

أوامر تكتبها في الطرفية. افهم ما يفعله الأمر قبل نسخه. الأوامر هنا: hermes whatsapp.

If the session breaks (phone reset, WhatsApp update, manually unlinked), you'll see connection errors in the gateway logs. To fix it:

Shellسطر واحد
hermes whatsapp

This generates a fresh QR code. Scan it again and the session is re-established. The gateway handles temporary disconnections (network blips, phone going offline briefly) automatically with reconnection logic.

---

Voice Messages

إعدادات تضبطها مرة وتنساها. غيّر واحدًا في كل مرة حتى تعرف أثر كل تغيير. تضبط GROQ_API_KEY، VOICE_TOOLS_OPENAI_KEY خارج المحادثة، في بيئة التشغيل.

Hermes supports voice on WhatsApp:

  • Incoming: Voice messages (.ogg opus) are automatically transcribed using the configured STT provider: local faster-whisper, Groq Whisper (GROQ_API_KEY), or OpenAI Whisper (VOICE_TOOLS_OPENAI_KEY)
  • Outgoing: TTS responses are sent as MP3 audio file attachments
  • Agent responses are prefixed with "⚕ Hermes Agent" by default. You can customize or disable this in config.yaml:
YAML5 أسطر
# ~/.hermes/config.yaml
whatsapp:
  reply_prefix: ""                          # Empty string disables the header
  # reply_prefix: "🤖 *My Bot*\n──────\n"  # Custom prefix (supports \n for newlines)
  send_read_receipts: false                 # Mark accepted inbound messages as read (blue ticks)

When send_read_receipts is true, the adapter marks policy-accepted inbound messages as read after DM/group/mention filtering passes. Rejected messages (e.g., from non-allowlisted senders) are not marked read. Disabled by default for privacy. Changing this setting automatically restarts the bridge subprocess on the next connection.

---

Message Formatting & Delivery

جدول مرجعي. لا تقرأه كله، ابحث عن السطر الذي يخصّك فقط.

WhatsApp supports streaming (progressive) responses — the bot edits its message in real-time as the AI generates text, just like Discord and Telegram. Internally, WhatsApp is classified as a TIER_MEDIUM platform for delivery capabilities.

Chunking

Long responses are automatically split into multiple messages at 4,096 characters per chunk (WhatsApp's practical display limit). You don't need to configure anything — the gateway handles splitting and sends chunks sequentially.

WhatsApp-Compatible Markdown

Standard Markdown in AI responses is automatically converted to WhatsApp's native formatting:

MarkdownWhatsAppRenders as
**bold***bold*bold
~~strikethrough~~~strikethrough~~~strikethrough~~
# Heading*Heading*Bold text (no native headings)
[link text](https://hermes-agent.nousresearch.com/docs/url)link text (url)Inline URL

Code blocks and inline code are preserved as-is since WhatsApp supports triple-backtick formatting natively.

Tool Progress

When the agent calls tools (web search, file operations, etc.), WhatsApp displays real-time progress indicators showing which tool is running. This is enabled by default — no configuration needed.

Native Polls, Clarify-as-Poll, and Locations

The Baileys-bridge adapter (bot mode) supports several native WhatsApp message types:

  • Polls — the agent can send a native WhatsApp poll (question + options) via the bridge's /send-poll endpoint. Poll votes flow back into the conversation.
  • Clarify questions as polls — when the agent asks a multiple-choice clarify question, it's rendered as a native single-select poll; tapping an option answers the question. If the poll fails to send, the adapter falls back to a plain text question. Approval prompts are never mapped onto polls — polls are only used for genuine multiple-choice clarifies.
  • Location pins — the agent can send a native location pin (latitude/longitude, optional name/address) via /send-location, and incoming shared locations (including live locations) are delivered to the agent as location messages.

All of this works out of the box in bot (Baileys) mode; no configuration needed.

Message Batching (Debounce)

WhatsApp delivers each message individually, so a rapid burst (forwarded batches, paste-splits, multi-line text) would otherwise trigger a separate agent invocation per fragment — wasting tokens and producing several disjointed replies. The adapter buffers successive text messages from the same chat and dispatches them as one combined request after a short quiet period (default 5s, extended to 10s for very long fragments). Tune via config.yaml:

YAML7 أسطر
# ~/.hermes/config.yaml
gateway:
  platforms:
    whatsapp:
      extra:
        text_batch_delay_seconds: 5.0         # quiet period before flushing a batch
        text_batch_split_delay_seconds: 10.0  # extended delay near the split threshold

Set text_batch_delay_seconds: 0 to dispatch each message immediately (disables batching).

---

Troubleshooting

قسم لحل المشكلات. ابحث فيه عن العطل الذي يشبه حالتك بدل قراءته كاملًا.

ProblemSolution
QR code not scanningEnsure terminal is wide enough (60+ columns). Try a different terminal. Make sure you're scanning from the correct WhatsApp account (bot number, not personal).
QR code expiresQR codes refresh every ~20 seconds. If it times out, restart hermes whatsapp.
Session not persistingCheck that ~/.hermes/platforms/whatsapp/session exists and is writable. If containerized, mount it as a persistent volume.
Logged out unexpectedlyWhatsApp unlinks devices after long inactivity. Keep the phone on and connected to the network, then re-pair with hermes whatsapp if needed.
Bridge crashes or reconnect loopsRestart the gateway, update Hermes, and re-pair if the session was invalidated by a WhatsApp protocol change.
Bot stops working after WhatsApp updateUpdate Hermes to get the latest bridge version, then re-pair.
macOS: "Node.js not installed" but node works in terminallaunchd services don't inherit your shell PATH. Run hermes gateway install to re-snapshot your current PATH into the plist, then hermes gateway start. See the Gateway Service docs for details.
Messages not being receivedVerify WHATSAPP_ALLOWED_USERS includes the sender's number (with country code, no + or spaces), or set it to * to allow everyone. Set WHATSAPP_DEBUG=true in .env and restart the gateway to see raw message events in bridge.log.
Bot replies to strangers with a pairing codeSet whatsapp.unauthorized_dm_behavior: ignore in ~/.hermes/config.yaml if you want unauthorized DMs to be silently ignored instead.

---

Security

فيه تحذير مهم. اقرأه قبل أن تنفّذ أي شيء من هذا القسم. نصّ التحذير من المصدر مذكور أسفل هذا الشرح.

By default, unauthorized DMs still receive a pairing code reply. If you want a private WhatsApp number to stay completely silent to strangers, set:

YAMLسطران
whatsapp:
  unauthorized_dm_behavior: ignore
  • The ~/.hermes/platforms/whatsapp/session directory contains full session credentials — protect it like a password
  • Set file permissions: chmod 700 ~/.hermes/platforms/whatsapp/session
  • Use a dedicated phone number for the bot to isolate risk from your personal account
  • If you suspect compromise, unlink the device from WhatsApp → Settings → Linked Devices
  • Phone numbers in logs are partially redacted, but review your log retention policy
اختبار الفهم

5 أسئلة إجاباتها كلها في هذه الصفحة.

كل خيار اسم حقيقي من توثيق Hermes. حتى الخيارات الخاطئة حقيقية، لكنها من صفحات أخرى.

1. بحسب هذا الدرس، أي أمر يقوم بـ«Foreground»؟
2. بحسب هذا الدرس، أي أمر يقوم بـ«Install as a user service»؟
3. في جدول هذا الدرس، ما «Cost» المقابل لـ«VoIP services»؟
4. أي متغير بيئة من التالي يظهر فعليًا في هذا الدرس؟
5. ما التحذير الذي يذكره المصدر في هذا الدرس؟