openclaw message
统一的消息发送命令,支持各种频道操作 (Discord / Google Chat / Slack / Mattermost(插件)/ Telegram / WhatsApp / Signal / iMessage / MS Teams)。
用法
openclaw message <subcommand> [flags]
频道选择:
--channel:如果配置了多个频道就必须指定。- 只配置了一个频道时,自动作为默认值。
- 可选值:
whatsapp|telegram|discord|googlechat|slack|mattermost|signal|imessage|msteams(Mattermost 需要插件)
目标格式(--target):
- WhatsApp:E.164 格式或群组 JID
- Telegram:chat id 或
@username - Discord:
channel:<id>或user:<id>(也接受<@id>提及;纯数字 id 当作频道处理) - Google Chat:
spaces/<spaceId>或users/<userId> - Slack:
channel:<id>或user:<id>(直接用频道 id 也行) - Mattermost(插件):
channel:<id>、user:<id>或@username(裸 id 当作频道处理) - Signal:
+E.164、group:<id>、signal:+E.164、signal:group:<id>,或username:<name>/u:<name> - iMessage:handle、
chat_id:<id>、chat_guid:<guid>或chat_identifier:<id> - MS Teams:会话 id(
19:[email protected])或conversation:<id>或user:<aad-object-id>
名称查找:
- 对支持的平台(Discord / Slack 等),可以用频道名称(如
Help或#help),会通过目录缓存解析。 - 缓存未命中时,如果平台支持,OpenClaw 会尝试实时目录查找。
通用参数
--channel <name>--account <id>--target <dest>(目标频道或用户,用于 send/poll/read 等)--targets <name>(可重复;仅用于 broadcast)--json--dry-run--verbose
操作
核心操作
-
send- 频道:WhatsApp / Telegram / Discord / Google Chat / Slack / Mattermost(插件)/ Signal / iMessage / MS Teams
- 必填:
--target,加上--message或--media - 可选:
--media、--reply-to、--thread-id、--gif-playback - 仅 Telegram:
--buttons(需要channels.telegram.capabilities.inlineButtons开启) - 仅 Telegram:
--thread-id(论坛话题 id) - 仅 Slack:
--thread-id(线程时间戳;--reply-to用的也是同一个字段) - 仅 WhatsApp:
--gif-playback
-
poll- 频道:WhatsApp / Telegram / Discord / Matrix / MS Teams
- 必填:
--target、--poll-question、--poll-option(可重复) - 可选:
--poll-multi - 仅 Discord:
--poll-duration-hours、--silent、--message - 仅 Telegram:
--poll-duration-seconds(5-600)、--silent、--poll-anonymous/--poll-public、--thread-id
-
react- 频道:Discord / Google Chat / Slack / Telegram / WhatsApp / Signal
- 必填:
--message-id、--target - 可选:
--emoji、--remove、--participant、--from-me、--target-author、--target-author-uuid - 注意:
--remove需要搭配--emoji(不传--emoji的话会清除自己的表情回应,如果平台支持的话;详见 /tools/reactions) - 仅 WhatsApp:
--participant、--from-me - Signal 群组回应:需要
--target-author或--target-author-uuid
-
reactions- 频道:Discord / Google Chat / Slack
- 必填:
--message-id、--target - 可选:
--limit
-
read- 频道:Discord / Slack
- 必填:
--target - 可选:
--limit、--before、--after - 仅 Discord:
--around
-
edit- 频道:Discord / Slack
- 必填:
--message-id、--message、--target
-
delete- 频道:Discord / Slack / Telegram
- 必填:
--message-id、--target
-
pin/unpin- 频道:Discord / Slack
- 必填:
--message-id、--target
-
pins(列出置顶消息)- 频道:Discord / Slack
- 必填:
--target
-
permissions- 频道:Discord
- 必填:
--target
-
search- 频道:Discord
- 必填:
--guild-id、--query - 可选:
--channel-id、--channel-ids(可重复)、--author-id、--author-ids(可重复)、--limit
线程
-
thread create- 频道:Discord
- 必填:
--thread-name、--target(频道 id) - 可选:
--message-id、--message、--auto-archive-min
-
thread list- 频道:Discord
- 必填:
--guild-id - 可选:
--channel-id、--include-archived、--before、--limit
-
thread reply- 频道:Discord
- 必填:
--target(线程 id)、--message - 可选:
--media、--reply-to
表情
-
emoji list- Discord:
--guild-id - Slack:无需额外参数
- Discord:
-
emoji upload- 频道:Discord
- 必填:
--guild-id、--emoji-name、--media - 可选:
--role-ids(可重复)
贴纸
-
sticker send- 频道:Discord
- 必填:
--target、--sticker-id(可重复) - 可选:
--message
-
sticker upload- 频道:Discord
- 必填:
--guild-id、--sticker-name、--sticker-desc、--sticker-tags、--media
角色 / 频道 / 成员 / 语音
role info(Discord):--guild-idrole add/role remove(Discord):--guild-id、--user-id、--role-idchannel info(Discord):--targetchannel list(Discord):--guild-idmember info(Discord / Slack):--user-id(Discord 还需要--guild-id)voice status(Discord):--guild-id、--user-id
活动
event list(Discord):--guild-idevent create(Discord):--guild-id、--event-name、--start-time- 可选:
--end-time、--desc、--channel-id、--location、--event-type
- 可选:
管理(Discord)
timeout:--guild-id、--user-id(可选--duration-min或--until;都不传则清除禁言)kick:--guild-id、--user-id(+--reason)ban:--guild-id、--user-id(+--delete-days、--reason)timeout也支持--reason
广播
broadcast- 频道:任何已配置的频道;用
--channel all可以面向所有平台 - 必填:
--targets(可重复) - 可选:
--message、--media、--dry-run
- 频道:任何已配置的频道;用
示例
发送一条 Discord 回复:
openclaw message send --channel discord \
--target channel:123 --message "hi" --reply-to 456
发送带组件的 Discord 消息:
openclaw message send --channel discord \
--target channel:123 --message "Choose:" \
--components '{"text":"Choose a path","blocks":[{"type":"actions","buttons":[{"label":"Approve","style":"success"},{"label":"Decline","style":"danger"}]}]}'
完整 schema 请参考 Discord components。
创建 Discord 投票:
openclaw message poll --channel discord \
--target channel:123 \
--poll-question "Snack?" \
--poll-option Pizza --poll-option Sushi \
--poll-multi --poll-duration-hours 48
创建 Telegram 投票(2 分钟后自动关闭):
openclaw message poll --channel telegram \
--target @mychat \
--poll-question "Lunch?" \
--poll-option Pizza --poll-option Sushi \
--poll-duration-seconds 120 --silent
发送 Teams 主动消息:
openclaw message send --channel msteams \
--target conversation:19:[email protected] --message "hi"
创建 Teams 投票:
openclaw message poll --channel msteams \
--target conversation:19:[email protected] \
--poll-question "Lunch?" \
--poll-option Pizza --poll-option Sushi
在 Slack 中添加表情回应:
openclaw message react --channel slack \
--target C123 --message-id 456 --emoji "✅"
在 Signal 群组中添加表情回应:
openclaw message react --channel signal \
--target signal:group:abc123 --message-id 1737630212345 \
--emoji "✅" --target-author-uuid 123e4567-e89b-12d3-a456-426614174000
发送 Telegram 内联按钮:
openclaw message send --channel telegram --target @mychat --message "Choose:" \
--buttons '[ [{"text":"Yes","callback_data":"cmd:yes"}], [{"text":"No","callback_data":"cmd:no"}] ]'