Skip to content

How to Find IDs with the openclaw directory Command

I’ve spent way too much time digging through logs or config files just to find a single user ID for a script. It is frustrating when you have a message ready to go but you are missing that one string of characters needed to actually hit “send.”

The openclaw directory command solves this. It lets you look up IDs for contacts, groups, and even your own account across different channels. Instead of guessing, you can pull the exact ID you need and paste it directly into your next command.

  • Openclaw installed and configured.
  • At least one active channel (like Slack, Telegram, or WhatsApp).

You can find the ID you need in about 30 seconds. Here are the four most common ways to use the directory.

If you need to message a specific person, use the peers list command. You can add a --query to filter by name.

Terminal window
openclaw directory peers list --channel zalouser --query "name"

To find a group ID, use the groups list command. This is helpful for finding those long, encoded strings used by apps like WhatsApp or Matrix.

Terminal window
openclaw directory groups list --channel zalouser --query "work"

Sometimes you need your own ID to test a script or set up a webhook.

Terminal window
openclaw directory self --channel zalouser

Once you have the ID, you can use it with the --target flag in the message command. Here is how that looks for Slack:

Terminal window
# Find the ID
openclaw directory peers list --channel slack --query "U0"
# Send the message using the ID found above
openclaw message send --channel slack --target user:U012ABCDEF --message "hello"

Different apps use different ID styles. Here is what you should look for when you run a directory search:

  • WhatsApp: Use +15551234567 for DMs or 1234567890-1234567890@g.us for groups.
  • Telegram: Use @username or numeric chat IDs.
  • Slack: Use user:U… or channel:C….
  • Discord: Use user:<id> or channel:<id>.
  • Matrix: Use user:@user:server or room:!roomId:server.
  • Microsoft Teams: Use user:<id> or conversation:<id>.

For many channels, results are based on your configuration files (like allowlists or pre-configured groups) rather than a live search of the provider’s entire database. If a user doesn’t show up, check if they are in your config.

If you have more than one channel set up, you must use the --channel <name> flag. Openclaw only selects the channel automatically if you have exactly one configured.

If you need more help setting this up, check out the AI Setup Assistant.

OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.