openclaw message
统一的出站命令,用于发送消息和 Channel 操作 (Discord/Google Chat/Slack/Mattermost (plugin)/Telegram/WhatsApp/Signal/iMessage/MS Teams)。
用法
openclaw message <subcommand> [flags]
Channel 选择:
- 如果配置了多个 Channel,需要指定
--channel。 - 如果只配置了一个 Channel,它会成为默认值。
- 可选值:
whatsapp|telegram|discord|googlechat|slack|mattermost|signal|imessage|msteams(Mattermost 需要 Plugin)
目标格式(--target):
- WhatsApp:E.164 格式或群组 JID
- Telegram:聊天 ID 或
@username - Discord:
channel:<id>或user:<id>(或<@id>提及;纯数字 ID 会被视为 Channel) - Google Chat:
spaces/<spaceId>或users/<userId> - Slack:
channel:<id>或user:<id>(接受纯 Channel ID) - Mattermost (plugin):
channel:<id>、user:<id>或@username(纯 ID 会被视为 Channel) - 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这样的 Channel 名称会通过目录缓存解析。 - 缓存未命中时,OpenClaw 会在提供商支持的情况下尝试实时目录查找。
常用标志
--channel <name>--account <id>--target <dest>(send/poll/read 等操作的目标 Channel 或用户)--targets <name>(可重复;仅用于 broadcast)--json--dry-run--verbose
操作
核心操作
-
send- Channel:WhatsApp/Telegram/Discord/Google Chat/Slack/Mattermost (plugin)/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- Channel:WhatsApp/Discord/MS Teams
- 必需:
--target、--poll-question、--poll-option(可重复) - 可选:
--poll-multi - 仅 Discord:
--poll-duration-hours、--message
-
react- Channel: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- Channel:Discord/Google Chat/Slack
- 必需:
--message-id、--target - 可选:
--limit
-
read- Channel:Discord/Slack
- 必需:
--target - 可选:
--limit、--before、--after - 仅 Discord:
--around
-
edit- Channel:Discord/Slack
- 必需:
--message-id、--message、--target
-
delete- Channel:Discord/Slack/Telegram
- 必需:
--message-id、--target
-
pin/unpin- Channel:Discord/Slack
- 必需:
--message-id、--target
-
pins(列表)- Channel:Discord/Slack
- 必需:
--target
-
permissions- Channel:Discord
- 必需:
--target
-
search- Channel:Discord
- 必需:
--guild-id、--query - 可选:
--channel-id、--channel-ids(可重复)、--author-id、--author-ids(可重复)、--limit
线程操作
-
thread create- Channel:Discord
- 必需:
--thread-name、--target(Channel ID) - 可选:
--message-id、--auto-archive-min
-
thread list- Channel:Discord
- 必需:
--guild-id - 可选:
--channel-id、--include-archived、--before、--limit
-
thread reply- Channel:Discord
- 必需:
--target(线程 ID)、--message - 可选:
--media、--reply-to
表情操作
-
emoji list- Discord:
--guild-id - Slack:无需额外标志
- Discord:
-
emoji upload- Channel:Discord
- 必需:
--guild-id、--emoji-name、--media - 可选:
--role-ids(可重复)
贴纸操作
-
sticker send- Channel:Discord
- 必需:
--target、--sticker-id(可重复) - 可选:
--message
-
sticker upload- Channel:Discord
- 必需:
--guild-id、--sticker-name、--sticker-desc、--sticker-tags、--media
角色 / Channel / 成员 / 语音
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:任何已配置的 Channel;使用
--channel all可以针对所有提供商 - 必需:
--targets(可重复) - 可选:
--message、--media、--dry-run
- Channel:任何已配置的 Channel;使用
示例
发送 Discord 回复:
openclaw message send --channel discord \
--target channel:123 --message "hi" --reply-to 456
创建 Discord 投票:
openclaw message poll --channel discord \
--target channel:123 \
--poll-question "Snack?" \
--poll-option Pizza --poll-option Sushi \
--poll-multi --poll-duration-hours 48
发送 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"}] ]'