#Help filtering whatsapp messages.

1 messages · Page 1 of 1 (latest)

modest tiger
#

I would like to filter messages at the gateway level (before an AI comes into place) so that only messages containing a keyword get processed. For example ignore "hello!" and respond to "hello bot!"

silk schoonerBOT
hidden pivotBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

silk schoonerBOT
wooden jewelBOT
#

Yes, for WhatsApp groups you can do this before the AI runs with mention gating plus mentionPatterns.

{
  channels: {
    whatsapp: {
      groups: {
        "*": { requireMention: true },
      },
    },
  },
  agents: {
    list: [
      {
        id: "main",
        groupChat: {
#
          mentionPatterns: ["\\bbot\\b"],
        },
      },
    ],
  },
}

That gives you:

  • hello!does not trigger
  • hello bot!does trigger

A couple notes:

  • mentionPatterns are case-insensitive regexes
#
  • skipped group messages are stored for context only, not sent to the AI as a trigger
  • this is the built-in path for group chats

For 1:1 WhatsApp DMs, I do not see a built-in generic keyword-only gateway filter in the current config/docs.

Docs:

If you want, paste your openclaw --version and whether this is a group or DM, and I’ll give you the exact config block.

modest tiger
#

OpenClaw 2026.4.15 (041266a), yes, I would like this to happen in 1:1 conversation, as I am sharing my phone with my openclaw, and the bot is reacting to every message I get from my allowlist contacts.

wooden jewelBOT
#

Thanks, that helps. On 2026.4.15, I do not see a built-in 1:1 WhatsApp DM keyword gate in config.

So, for normal DMs:

  • hello! vs hello bot! style filtering is not currently a gateway config feature
  • mentionPatterns / requireMention are for groups
  • selfChatMode helps with personal-number setups, but it is not a generic DM keyword filter

If your goal is “don’t let OpenClaw reply to my normal contacts on my shared phone”, the supported options are:

  1. Only allow yourself in WhatsApp DMs
  2. Use a dedicated WhatsApp number for OpenClaw, which the docs explicitly recommend

Practical config for personal-number mode:

#
{
  session: {
    dmScope: "per-channel-peer",
  },
  channels: {
    whatsapp: {
      dmPolicy: "allowlist",
      allowFrom: ["+YOUR_NUMBER_ONLY"],
      selfChatMode: true,
    },
  },
}

Notes:

#
  • allowFrom with multiple contacts means those contacts can all trigger the bot
  • session.dmScope: "per-channel-peer" is strongly recommended if multiple people can DM it, so their conversations do not share one session, but it does not solve keyword gating

So the honest answer is: for 1:1 DMs, “only trigger if message contains keyword X” is not built in today. If you need that exact behavior, it’s a feature request: https://github.com/openclaw/openclaw/issues

Docs:

If you want, I can help you turn your current setup into the safest personal-number/self-chat config.