OpenClaw operations guide

OpenClaw Matrix bot setup for your first DM reply

OpenClaw Matrix bot setup needs a running Gateway, the Matrix plugin, your homeserver URL and a bot access token. Invite the bot to a private, unencrypted DM from a second account. Accept the invite as the bot, then message it from the sender account. Approve the pairing code in OpenClaw and send another message for a reply.

Last updated · Published

By CWYN · Reviewed November 19, 2026 against OpenClaw 2026.11.5 · Checked against docs, not run (Matrix setup reference)

1. Create the bot account and save its access token

Start with a working local managed Gateway, a reachable Matrix homeserver, and two accounts you control. Use one as the bot and the other as the sender. Use a private, unencrypted test DM and send only test text. For an encrypted DM, follow the separate Matrix encryption setup first.

Create the bot account on your homeserver. Get an access token for that account from your Matrix client or homeserver admin UI, as described in the Matrix setup reference. On a default OpenClaw installation, save it as MATRIX_ACCESS_TOKEN in the private global environment file at ~/.openclaw/.env. Preserve the existing entries.

2. Install and configure the Matrix plugin

openclaw plugins install @openclaw/matrix

Save this example as matrix.patch.json5 and replace the sample homeserver with the bot’s HTTPS homeserver URL. The patch references the token, requires DM pairing, and leaves group handling and automatic invite acceptance off.

Before changing the homeserver and invite settings, record how to restore your previous configuration.

{
  channels: {
    matrix: {
      enabled: true,
      homeserver: "https://matrix.example.org",
      accessToken: { source: "env", provider: "default", id: "MATRIX_ACCESS_TOKEN" },
      dm: { policy: "pairing" },
      groupPolicy: "disabled",
      autoJoin: "off",
    },
  },
}

Restart the managed Gateway so it reads the token before you apply the patch. Use the config CLI to validate and apply the patch. Follow its restart hint before probing the channel.

openclaw gateway restart
openclaw config patch --file ./matrix.patch.json5 --dry-run
openclaw config patch --file ./matrix.patch.json5
openclaw channels status --probe

3. Accept the DM invitation as the bot

Use your sender account to open a direct conversation with the bot’s full Matrix user ID. In a client signed in as the bot, accept that invitation. Matrix handles invites before it checks DM policy, so starting a DM alone leaves the bot outside the room when automatic joining is off.

4. Approve the sender

After the bot joins, send a short test message from your sender account. Follow the Matrix pairing procedure and approve the code from your own DM. Check the sender before approving, since the first CLI approval can establish the command owner.

openclaw pairing list matrix
openclaw pairing approve matrix <CODE>

5. Check the reply in the joined DM

Send a fresh message from your sender account in the same DM. Check for a new message from the bot account in that room. Keep the invite acceptance and the agent reply as separate checks if you need to diagnose a missing response.

If you plan to move this setup to Hermes, save the working DM as a reference, then preview what Hermes can import from OpenClaw.

To repeat the test in a shared Nextcloud Talk room, allow one sender in a private Talk room using the room token and Nextcloud user ID.

Get your free CWYN Score

Next steps

Keep a record of the Matrix reply

The OpenClaw Complete Setup Pack ($14.95) is an optional paid kit with a Gateway checklist for recording the account and the private reply you verified.
Kit details as of Nov 22, 2026