Skip to main content

Overview

Ravi can create and manage WhatsApp groups programmatically through the CLI. Groups are managed via the ravi whatsapp group commands, which communicate with the WhatsApp instance through NATS request/reply. All commands require the daemon to be running with a connected WhatsApp account.

Prerequisites

  • Daemon running: ravi daemon start
  • WhatsApp connected: ravi whatsapp connect
  • Participants must exist as contacts before being added to groups

Creating Groups

Basic Group Creation

Participants are specified as a comma-separated list of phone numbers. Every participant must already exist in your contacts database — the command validates this before creating the group and will fail with suggestions if any number is unknown.

Group Creation with Agent Routing

The --agent flag is the recommended approach. It creates the group, approves the group contact, sets up the route, creates the session, and sends an introductory prompt to the agent — all in one command:
This single command:
  1. Creates the WhatsApp group
  2. Registers the group as an approved contact
  3. Creates a route mapping the group to the specified agent
  4. Creates a named session for the group
  5. Sends an [System] Inform so the agent introduces itself to the group
Output:

Group Creation Without Agent

Without --agent, the group contact is still auto-approved, but routing must be configured manually:

Admin Auto-Promotion

When creating a group, Ravi automatically promotes any contacts tagged with admin to group admin. This happens silently after group creation:

Managing Members

Adding Participants

Participants are validated against your contacts database before being added.

Removing Participants

Promoting to Admin

Demoting from Admin

Group Info and Listing

List All Groups

Shows all groups the bot participates in, including group ID, name, and member count. Communities are excluded from the main list.

View Group Details

Returns full metadata:
  • Group ID, owner, and size
  • Creation date
  • Announcement mode (admins-only messaging)
  • Restrict mode (locked info editing)
  • Description
  • Ephemeral message timer (if set)
  • Full participant list with admin status

Group ID Formats

Commands accept two formats for group IDs:

Revoke and Regenerate

Revoking invalidates the current invite link and generates a new one:

Group Settings

Announcement Mode

Controls who can send messages in the group:

Locked Mode

Controls who can edit group info (name, description, picture):

Renaming a Group

Updating the Description

Leaving a Group

Group Routing

Groups are routed to agents through the same mechanism as direct messages — via routes on the instance. Use --agent when creating the group:

Manual Routing

Add a route for an existing group:

Routing Priority

Group messages follow the same resolution order as DMs:
  1. Route match on the instance (pattern group:<id>)
  2. Account-agent mapping
  3. Default agent

Multi-Account Support

All group commands accept --account to specify which WhatsApp account to use. This is essential when running multiple WhatsApp instances:
When --account is omitted, the first connected WhatsApp instance is used.

Common Workflows

Set Up a Project Group

Distribute a Temporary Invite

Reorganize Group Members