使用 allowFrom 设置发送者白名单
使用 channels. .allowFrom 限制哪些人可以向您的助手发送消息。
使用 allowFrom 设置发送者白名单 是 CoddyKit 上的免费 OpenClaw Academy 课时。 这是第 2 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 OpenClaw Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 OpenClaw Academy 课程共包含 4 节课。
本课时的部分内容尚未翻译,以英文显示。
Who Can Reach You
OpenClaw has full system access, so you decide who may message it. The allowlist is your front door, and only listed people get in. 🔐
Meet allowFrom
The key for this is allowFrom. It lives inside a channel block and holds the senders you trust to talk to your assistant.
channels: {
whatsapp: {
allowFrom: []
}
}Where It Sits
The full path is channels.platform.allowFrom. Swap platform for whatsapp, telegram, or any channel you have connected.
It Is a List
allowFrom takes a list of senders. For WhatsApp that means phone numbers, so each entry is one trusted contact.
allowFrom: ["+15555550123"]Adding More Senders
Need more people? Just add more entries to the list. Every number you include can message and command your assistant.
allowFrom: [
"+15555550123",
"+15555550199"
]A Full WhatsApp Block
Here is allowFrom inside a real whatsapp block. This is the shape you edit in openclaw.json to gate the channel.
channels: {
whatsapp: {
allowFrom: ["+15555550123"]
}
}Why Allowlisting First
Allowlisting is the simplest guardrail. Before any clever rules, deciding who is on the list keeps strangers from driving your machine.
Per Channel
Each channel keeps its own allowFrom. Your WhatsApp list and your Telegram list are separate, so you tune access per platform.
Use the Right Format
Match the sender format the platform expects. For WhatsApp use full international numbers, including the country code, so they match correctly.
Apply Your Changes
After editing allowFrom, save the file and restart OpenClaw. The new list takes effect once the assistant reloads its config.
Trust by Design
Keep the list tight. Add only people you truly trust, because everyone on it can ask your assistant to act on your system.
Quick Check
Test your grip on the allowlist key.
Recap
You set the guest list: allowFrom names the senders allowed per channel. Tight lists keep you safe. Next, group mention rules. ✅
常见问题解答
「使用 allowFrom 设置发送者白名单」课时是免费的吗?
是的 — 「使用 allowFrom 设置发送者白名单」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 OpenClaw Academy 课程的其余内容,请升级到 CoddyKit PRO。 OpenClaw Academy 课程共包含 4 节课。
「使用 allowFrom 设置发送者白名单」这节课中我会学到什么?
使用 channels. .allowFrom 限制哪些人可以向您的助手发送消息。 你通过在浏览器中直接运行的动手代码来练习 OpenClaw Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。
学习 OpenClaw Academy 需要有经验吗?
无需任何先前经验。CoddyKit 上的 OpenClaw Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 2 节课,共 4 节。
「使用 allowFrom 设置发送者白名单」课时需要多长时间?
大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。
我能在这节 OpenClaw Academy 课中编写并运行代码吗?
能。每节 OpenClaw Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。
此课程中的所有课时
- openclaw.json 配置文件
- 使用 allowFrom 设置发送者白名单
- 使用 requireMention 和 mentionPatterns 设置群组规则
- 未进行配置时的默认行为