跳到內容

使用 openclaw message 統一管理多平台訊息與操作

開發時最麻煩的就是要串接各種不同的通訊平台。每個 API 的認證方式、訊息格式、甚至連 Target ID 的寫法都大不相同。你可能剛寫完 Discord 的機器人,轉頭又要去研究 Slack 的 Thread 怎麼回覆,或是 WhatsApp 的群組 JID 怎麼拿。

如果你正在尋找一種不需要切換多套 SDK,就能統一發送訊息、建立投票或管理頻道的方法,openclaw message 就是為了幫你解決這些瑣事而設計的。

  • 已安裝並配置好的 OpenClaw
  • 至少一個已設定的通訊 Channel
  • Mattermost 平台需安裝 plugin
  • Telegram 進階功能需開啟 channels.telegram.capabilities.inlineButtons

只要 5 分鐘,你就能學會如何跨平台發送訊息。

如果你的 OpenClaw 只配置了一個平台,它會自動成為預設值。如果有多個平台,你需要使用 --channel 指定。

每個平台的 --target 格式不太一樣:

  • WhatsApp: E.164 號碼或群組 JID
  • Telegram: chat id 或 @username
  • Discord: channel:<id> 或 user:<id>
  • Slack: channel:<id> 或 user:<id>

你可以直接在終端機輸入指令來發送 Discord 回覆:

Terminal window
openclaw message send --channel discord \
--target channel:123 --message "hi" --reply-to 456

或是發送帶有按鈕的 Telegram 訊息:

Terminal window
openclaw message send --channel telegram --target @mychat --message "Choose:" \
--buttons '[ [{"text":"Yes","callback_data":"cmd:yes"}], [{"text":"No","callback_data":"cmd:no"}] ]'

除了發訊息,你還能發起投票或加入表情回應。例如在 Slack 針對某則訊息按讚:

Terminal window
openclaw message react --channel slack \
--target C123 --message-id 456 --emoji "✅"

或是建立一個 Discord 投票:

Terminal window
openclaw message poll --channel discord \
--target channel:123 \
--poll-question "Snack?" \
--poll-option Pizza --poll-option Sushi \
--poll-multi --poll-duration-hours 48

openclaw message 支援非常完整的操作,涵蓋了從基礎訊息到社群管理的各個面向:

  • 核心操作: send, poll, react, read, edit, delete, pin
  • 執行緒管理: thread create, thread list, thread reply
  • 表情與貼圖: emoji list, emoji upload, sticker send, sticker upload
  • 成員與權限: role add/remove, channel info, member info, voice status
  • 活動與審核: event create, timeout, kick, ban
  • 廣播: 使用 broadcast --channel all 同時向所有平台發送訊息
  • 找不到 Channel: 如果你配置了超過一個 Channel,記得一定要加上 --channel 參數,否則指令會不知道該往哪裡發送。
  • Telegram 按鈕沒出現: 請檢查你的配置檔案中,channels.telegram.capabilities.inlineButtons 是否已設定為開啟。
  • Signal 回應失敗: 在 Signal 群組中進行 react 時,必須額外提供 --target-author 或 --target-author-uuid。
  • Mattermost 無法使用: 請確認你的 Mattermost 伺服器已經安裝了 OpenClaw 的對應 plugin。

有任何設定上的問題嗎?直接問我們的 AI Setup Assistant 吧!

OpenClaw

OpenClaw Expert

還是卡住了?

如果這篇文件沒有解決你的情境,直接問 OpenClaw Expert,拿到可執行步驟。