Skip to content

[Feature]: hermes whatsapp setup — Interactive one-command WhatsApp configuration wizard #58041

Description

@webtecnica

Problem

Setting up WhatsApp on Hermes Agent is significantly more complex and error-prone than other platforms — especially Telegram, which has a straightforward hermes gateway setup flow that just asks for a bot token and works.

WhatsApp requires at least 4 manual configuration steps that a new user cannot reasonably discover on their own:

  1. Pairinghermes whatsapp → scan QR. This works (more or less).
  2. Allowlist — Set WHATSAPP_ALLOWED_USERS to the owner's personal phone number, NOT the bot's number. This distinction is not documented or obvious. First-time users routinely set it to the bot's own number, locking themselves out.
  3. DM policy — Change dm_policy from "open" to "allowlist" in config.yaml, otherwise the gateway refuses to start when WHATSAPP_ALLOW_ALL_USERS=false.
  4. Home channel — Set WHATSAPP_HOME_CHANNEL in .env for cron delivery. Without this, cron job output never reaches the user on WhatsApp.

On top of that:

  • The gateway service must be restarted via hermes-gateway.service (not hermes-dashboard), which is easy to confuse.
  • The delivery format for cron targets is unintuitive: whatsapp:<LID>@lid (not the phone JID format <number>@s.whatsapp.net).
  • There is no built-in test to verify delivery works after setup.

This matters because WhatsApp is the dominant messaging platform in many countries — Brazil, India, Mexico, much of Europe, Southeast Asia, and Africa. For users in these regions, WhatsApp is not a "nice to have" integration; it's the primary way they interact with messaging services. A painful WhatsApp setup creates a disproportionate onboarding barrier for a huge portion of the global user base.

Proposed Solution: hermes whatsapp setup Interactive Wizard

A single guided command that configures everything in one pass:

$ hermes whatsapp setup
┌─ WhatsApp Setup ──────────────────────────────────┐
│                                                    │
│  This will guide you through WhatsApp setup.       │
│  You'll need your WhatsApp account ready to scan   │
│  a QR code.                                        │
│                                                    │
├────────────────────────────────────────────────────┤
│                                                    │
│  Step 1/4: Pairing                                  │
│  ─────────────────                                  │
│  Starting WhatsApp bridge...                        │
│                                                    │
│  📱 Scan this QR code with WhatsApp:               │
│  ┌─────────────────────────────────────────┐       │
│  │           ██████████████████            │       │
│  │           ██  QR CODE  ██               │       │
│  │           ██████████████████            │       │
│  └─────────────────────────────────────────┘       │
│                                                    │
│  ✓ Paired successfully as: 5511999999999           │
│                                                    │
├────────────────────────────────────────────────────┤
│                                                    │
│  Step 2/4: Who can use this bot?                    │
│  ───────────────────────────────                    │
│                                                    │
│  We detected your paired account: 5511999999999     │
│                                                    │
│  Is this YOUR personal number? [Y/n]                │
│  → Y                                               │
│                                                    │
│  ✓ WHATSAPP_ALLOWED_USERS = 5511999999999           │
│  ✓ WHATSAPP_ALLOW_ALL_USERS = false                 │
│  ✓ dm_policy = allowlist                           │
│                                                    │
├────────────────────────────────────────────────────┤
│                                                    │
│  Step 3/4: Cron delivery home channel               │
│  ─────────────────────────────────────              │
│                                                    │
│  Should cron job output be delivered here? [Y/n]    │
│  → Y                                               │
│                                                    │
│  ✓ WHATSAPP_HOME_CHANNEL = <your_chat_id>           │
│                                                    │
├────────────────────────────────────────────────────┤
│                                                    │
│  Step 4/4: Test delivery                            │
│  ───────────────────────                            │
│                                                    │
│  Sending test message...                            │
│  ✓ Test message delivered to your WhatsApp!        │
│                                                    │
├────────────────────────────────────────────────────┤
│                                                    │
│  ✅ WhatsApp fully configured!                      │
│                                                    │
│  Summary:                                           │
│  ─────────────────────────────────────────────      │
│  Paired as:       5511999999999                     │
│  Allowed users:    5511999999999 (only you)         │
│  DM policy:        allowlist (no randoms)           │
│  Groups:           blocked                          │
│  Home channel:     ✓ (cron deliveries enabled)      │
│  Test delivery:    ✓                                │
│                                                    │
└────────────────────────────────────────────────────┘

Under the hood, the wizard would:

  1. Pair (reuse existing hermes whatsapp flow)
  2. Detect owner — After pairing, read creds.json's me.id to know the bot's own number. Ask the user if this is their personal number, or let them type a different one.
  3. Set allowlist — Write WHATSAPP_ALLOWED_USERS=<owner_number> and WHATSAPP_ALLOW_ALL_USERS=false to .env.
  4. Set dm_policy — Run hermes config set whatsapp.dm_policy allowlist (handles the config.yaml restriction the agent has).
  5. Set home channel — Detect the user's chat LID from the lid-mapping files and write WHATSAPP_HOME_CHANNEL=<LID>@lid to .env.
  6. Test delivery — Send a test message via the bridge to confirm everything works.
  7. Restart gateway — Prompt to restart hermes-gateway.service.
  8. Print summary — Clear overview of what was configured.

Benefits

  • Parity with Telegram setup — Telegram's hermes gateway setup asks for a token and works. WhatsApp should be equally straightforward.
  • Eliminates the "wrong number" trap — The Terminal tool #1 mistake (setting the bot's number instead of the owner's) is caught automatically.
  • No manual .env editing — All three env vars (ALLOWED_USERS, ALLOW_ALL_USERS, HOME_CHANNEL) plus dm_policy in config.yaml are set by the wizard.
  • Works out of the box — New users in WhatsApp-dominant countries (Brazil, India, Mexico, etc.) can be productive in minutes, not hours.
  • Self-verifying — The test step catches silent failures immediately.

Implementation Considerations

  • The hermes_cli/main.py already has a whatsapp_setup function (around line 2506) that handles allowlist configuration — this could be extended.
  • The gateway already exposes _standalone_send for WhatsApp — the test step can reuse this.
  • No new dependencies needed — everything uses existing infrastructure (qrcode for pairing, the bridge for sending, hermes config for YAML edits).
  • The wizard should be idempotent — re-running it should update the config, not error out.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/whatsappWhatsApp Business adaptertype/featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions