Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Openclaw Openclaw DashboardCommand

From Leeroopedia


Knowledge Sources
Domains CLI, Verification, Dashboard
Last Updated 2026-02-06 12:00 GMT

Overview

Concrete post-setup verification tools for the OpenClaw gateway, provided by dashboardCommand in src/commands/dashboard.ts and messageCommand in src/commands/message.ts.

Description

dashboardCommand opens the OpenClaw Control UI web dashboard in the user's browser. It reads the gateway configuration to resolve the correct URL (accounting for port, bind address, custom host, and base path), copies the URL to the clipboard, and attempts to launch the default browser. If browser launch is not available (e.g., headless server), it prints the URL along with an SSH port-forwarding hint.

messageCommand sends a message through a configured channel from the CLI. It resolves the message action (send, poll, etc.), constructs outbound delivery dependencies, executes the action through the same pipeline the gateway uses for real messages, and outputs the result in either human-readable text or JSON format.

Usage

dashboardCommand is invoked by the openclaw dashboard CLI command, typically run after onboarding or whenever the user wants to access the Control UI. messageCommand is invoked by the openclaw message send CLI command for sending test messages or automated outbound messages.

Code Reference

Source Location (dashboardCommand)

  • Repository: openclaw
  • File: src/commands/dashboard.ts
  • Lines: 16-62

Source Location (messageCommand)

  • Repository: openclaw
  • File: src/commands/message.ts
  • Lines: 14-67

Signature (dashboardCommand)

export async function dashboardCommand(
  runtime: RuntimeEnv = defaultRuntime,
  options: DashboardOptions = {},
): Promise<void>

Signature (messageCommand)

export async function messageCommand(
  opts: Record<string, unknown>,
  deps: CliDeps,
  runtime: RuntimeEnv,
): Promise<void>

Import

import { dashboardCommand } from "../commands/dashboard.js";
import { messageCommand } from "../commands/message.js";

I/O Contract

Inputs (dashboardCommand)

Name Type Required Description
runtime RuntimeEnv No (defaults to defaultRuntime) Provides log for output.
options DashboardOptions No (defaults to {}) noOpen: if true, skips browser launch and prints the URL only.

Outputs (dashboardCommand)

Name Type Description
(return) Promise<void> Resolves after logging the dashboard URL and optionally opening the browser.

Inputs (messageCommand)

Name Type Required Description
opts Record<string, unknown> Yes CLI options including action (message action name, defaults to "send"), json (output JSON), dryRun (simulate without sending), plus channel-specific parameters (e.g., channel, to, body).
deps CliDeps Yes Dependency injection object providing per-channel send functions: sendMessageWhatsApp, sendMessageTelegram, sendMessageDiscord, sendMessageSlack, sendMessageSignal, sendMessageIMessage.
runtime RuntimeEnv Yes Provides log for output.

Outputs (messageCommand)

Name Type Description
(return) Promise<void> Resolves after the message is sent (or simulated) and the result is printed. Throws if the action is unknown.

Internal Flow (dashboardCommand)

  1. Read config -- loads the config snapshot via readConfigFileSnapshot.
  2. Resolve URL -- calls resolveControlUiLinks with the gateway port, bind mode, custom host, and base path to construct the dashboard URL.
  3. Log URL -- prints the dashboard URL to the terminal.
  4. Copy to clipboard -- calls copyToClipboard(dashboardUrl) (best-effort, catches errors).
  5. Browser detection -- calls detectBrowserOpenSupport() to check if a browser can be launched.
  6. Open or hint -- if browser is available and noOpen is not set, calls openUrl(dashboardUrl). If browser is unavailable, calls formatControlUiSshHint to generate an SSH tunnel command.
  7. Report -- logs whether the browser was opened or provides the fallback hint.

Internal Flow (messageCommand)

  1. Load config -- calls loadConfig() to read the active configuration.
  2. Resolve action -- parses opts.action (defaulting to "send") and matches it against CHANNEL_MESSAGE_ACTION_NAMES.
  3. Create outbound deps -- calls createOutboundSendDeps(deps) to wrap per-channel send functions.
  4. Execute action -- calls runMessageAction with the config, action, params, outbound deps, and gateway client info.
  5. Progress spinner -- for send and poll actions (when not in JSON or dry-run mode), wraps execution in a withProgress spinner.
  6. Format output -- if json mode, serializes the result via buildMessageCliJson. Otherwise, formats via formatMessageCliText and prints each line.

Usage Examples

Opening the Dashboard

import { dashboardCommand } from "../commands/dashboard.js";

// Open dashboard in browser
await dashboardCommand();

// Print URL only (headless mode)
await dashboardCommand(defaultRuntime, { noOpen: true });

Sending a Test Message

import { messageCommand } from "../commands/message.js";

await messageCommand(
  {
    action: "send",
    channel: "telegram",
    to: "123456789",
    body: "Hello from OpenClaw!",
  },
  cliDeps,
  defaultRuntime,
);

Sending a Message with JSON Output

import { messageCommand } from "../commands/message.js";

await messageCommand(
  {
    action: "send",
    channel: "discord",
    to: "channel-id",
    body: "Test message",
    json: true,
  },
  cliDeps,
  defaultRuntime,
);

Key Dependencies

Dependency Purpose
commander CLI command registration and option parsing (upstream)
src/config/config.js readConfigFileSnapshot, loadConfig, resolveGatewayPort for reading gateway configuration
src/infra/clipboard.js copyToClipboard for clipboard integration
src/commands/onboard-helpers.js resolveControlUiLinks, detectBrowserOpenSupport, openUrl, formatControlUiSshHint for URL resolution and browser handling
src/infra/outbound/message-action-runner.js runMessageAction for executing outbound message delivery
src/cli/outbound-send-deps.js createOutboundSendDeps for wrapping channel-specific send functions
src/cli/progress.js withProgress for spinner display during send/poll operations
src/commands/message-format.js buildMessageCliJson, formatMessageCliText for output formatting

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment