Appearance
openclaw message
统一的出站消息发送和频道操作命令,支持 Discord/Google Chat/Slack/Mattermost(插件)/Telegram/WhatsApp/Signal/iMessage/Microsoft Teams。
用法
openclaw message <subcommand> [flags]频道选择:
- 配置了多个频道时,
--channel是必填项。 - 如果只配置了一个频道,它会成为默认值。
- 可选值:
whatsapp|telegram|discord|googlechat|slack|mattermost|signal|imessage|msteams(Mattermost 需要插件)
目标格式(--target):
- WhatsApp:E.164 格式或群组 JID
- Telegram:聊天 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> - Microsoft Teams:对话 id(
19:...@thread.tacv2)或conversation:<id>或user:<aad-object-id>
名称查找:
- 对于支持的提供者(Discord/Slack 等),频道名称如
Help或#help会通过目录缓存解析。 - 缓存未命中时,OpenClaw 会在提供者支持的情况下尝试实时目录查找。
通用标志
--channel <name>--account <id>--target <dest>(发送/投票/读取等的目标频道或用户)--targets <name>(可重复;仅限广播)--json--dry-run--verbose
SecretRef 行为
openclaw message在运行选定操作前会解析支持的频道 SecretRef。- 解析尽可能限定在活跃的操作目标范围内:
- 设置了
--channel(或从带前缀的目标如discord:...推断出)时限定到频道范围 - 设置了
--account时限定到账户范围(频道全局 + 选定账户的字段) - 省略
--account时,OpenClaw 不会强制使用default账户 SecretRef 范围
- 设置了
- 不相关频道上未解析的 SecretRef 不会阻止有目标的消息操作。
- 如果选定的频道/账户 SecretRef 未解析,该操作的命令会安全失败。
操作
核心操作
send(发送消息)- 频道:WhatsApp/Telegram/Discord/Google Chat/Slack/Mattermost(插件)/Signal/iMessage/Microsoft Teams
- 必填:
--target,加上--message或--media - 可选:
--media、--reply-to、--thread-id、--gif-playback - 仅 Telegram:
--buttons(需要channels.telegram.capabilities.inlineButtons允许) - 仅 Telegram:
--force-document(将图片和 GIF 作为文件发送以避免 Telegram 压缩) - 仅 Telegram:
--thread-id(论坛话题 id) - 仅 Slack:
--thread-id(线程时间戳;--reply-to使用同一字段) - 仅 WhatsApp:
--gif-playback
poll(发起投票)- 频道:WhatsApp/Telegram/Discord/Matrix/Microsoft 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 操作
emoji list(列出 Emoji)- Discord:
--guild-id - Slack:无额外标志
- Discord:
emoji upload(上传 Emoji)- 频道: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:abc@thread.tacv2 --message "hi"创建 Teams 投票:
openclaw message poll --channel msteams \
--target conversation:19:abc@thread.tacv2 \
--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"}] ]'将 Telegram 图片作为文件发送(避免压缩):
bash
openclaw message send --channel telegram --target @mychat \
--media ./diagram.png --force-document