16 KiB
| read_when | summary | title | x-i18n | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
ข้อมูลอ้างอิง CLI สำหรับ `openclaw message` (ส่ง + การดำเนินการของแชนแนล) | ข้อความ |
|
openclaw message
คำสั่งขาออกแบบรวมสำหรับการส่งข้อความและการดำเนินการของแชนแนล (Discord/Google Chat/iMessage/Matrix/Mattermost (Plugin)/Microsoft Teams/Signal/Slack/Telegram/WhatsApp)
การใช้งาน
openclaw message <subcommand> [flags]
การเลือกแชนแนล:
- ต้องระบุ
--channelหากมีการกำหนดค่ามากกว่าหนึ่งแชนแนล - หากมีการกำหนดค่าไว้เพียงแชนแนลเดียว แชนแนลนั้นจะกลายเป็นค่าเริ่มต้น
- ค่า:
discord|googlechat|imessage|matrix|mattermost|msteams|signal|slack|telegram|whatsapp(Mattermost ต้องใช้ Plugin)
รูปแบบเป้าหมาย (--target):
- WhatsApp: E.164 หรือ group JID
- Telegram: chat id หรือ
@username - Discord:
channel:<id>หรือuser:<id>(หรือ mention แบบ<@id>; id ตัวเลขล้วนจะถูกตีความเป็นแชนแนล) - Google Chat:
spaces/<spaceId>หรือusers/<userId> - Slack:
channel:<id>หรือuser:<id>(ยอมรับ channel id แบบดิบ) - Mattermost (Plugin):
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> - Matrix:
@user:server,!room:server, หรือ#alias:server - Microsoft Teams: conversation id (
19:...@thread.tacv2) หรือconversation:<id>หรือuser:<aad-object-id>
การค้นหาชื่อ:
- สำหรับผู้ให้บริการที่รองรับ (Discord/Slack/อื่นๆ) ชื่อแชนแนล เช่น
Helpหรือ#helpจะถูก resolve ผ่านแคชไดเรกทอรี - หากไม่พบในแคช OpenClaw จะพยายามค้นหาไดเรกทอรีแบบสดเมื่อผู้ให้บริการรองรับ
แฟล็กร่วม
--channel <name>--account <id>--target <dest>(แชนแนลหรือผู้ใช้เป้าหมายสำหรับ send/poll/read/อื่นๆ)--targets <name>(ระบุซ้ำได้; ใช้กับ broadcast เท่านั้น)--json--dry-run--verbose
พฤติกรรมของ SecretRef
openclaw messageจะ resolve SecretRefs ของแชนแนลที่รองรับก่อนรันการดำเนินการที่เลือก- การ resolve จะถูกจำกัดขอบเขตตามเป้าหมายของการดำเนินการที่ใช้งานอยู่เมื่อทำได้:
- ระดับแชนแนลเมื่อมีการตั้ง
--channel(หรืออนุมานได้จาก target ที่มีคำนำหน้า เช่นdiscord:...) - ระดับบัญชีเมื่อมีการตั้ง
--account(global ของแชนแนล + พื้นผิวของบัญชีที่เลือก) - เมื่อไม่ระบุ
--accountOpenClaw จะไม่บังคับขอบเขต SecretRef ของบัญชีdefault
- ระดับแชนแนลเมื่อมีการตั้ง
- SecretRefs ที่ resolve ไม่ได้ในแชนแนลที่ไม่เกี่ยวข้องจะไม่บล็อกการดำเนินการข้อความแบบเจาะจงเป้าหมาย
- หาก SecretRef ของแชนแนล/บัญชีที่เลือก resolve ไม่ได้ คำสั่งจะ fail closed สำหรับการดำเนินการนั้น
การดำเนินการ
Core
-
send- แชนแนล: WhatsApp/Telegram/Discord/Google Chat/Slack/Mattermost (Plugin)/Signal/iMessage/Matrix/Microsoft Teams
- ต้องระบุ:
--targetและ--message,--media, หรือ--presentation - ไม่บังคับ:
--media,--presentation,--delivery,--pin,--reply-to,--thread-id,--gif-playback,--force-document,--silent - payload
presentationที่ใช้ร่วมกัน:--presentationจะส่งบล็อกเชิงความหมาย (text,context,divider,buttons,select) ที่ core เรนเดอร์ผ่านความสามารถที่ประกาศไว้ของแชนแนลที่เลือก ดู Message Presentation - ค่ากำหนดการส่งแบบทั่วไป:
--deliveryรับคำใบ้การส่ง เช่น{ "pin": true };--pinเป็นรูปแบบย่อสำหรับการส่งแบบปักหมุดเมื่อแชนแนลรองรับ - เฉพาะ Telegram:
--force-document(ส่งรูปภาพและ GIF เป็นเอกสารเพื่อหลีกเลี่ยงการบีบอัดของ Telegram) - เฉพาะ Telegram:
--thread-id(forum topic id) - เฉพาะ Slack:
--thread-id(thread timestamp;--reply-toใช้ฟิลด์เดียวกัน) - Telegram + Discord:
--silent - เฉพาะ 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/Matrix
- ต้องระบุ:
--message-id,--target - ไม่บังคับ:
--emoji,--remove,--participant,--from-me,--target-author,--target-author-uuid - หมายเหตุ:
--removeต้องใช้ร่วมกับ--emoji(หากไม่ระบุ--emojiจะเป็นการล้าง reaction ของตัวเองในแชนแนลที่รองรับ; ดู /tools/reactions) - เฉพาะ WhatsApp:
--participant,--from-me - reaction ในกลุ่ม Signal: ต้องระบุ
--target-authorหรือ--target-author-uuid
-
reactions- แชนแนล: Discord/Google Chat/Slack/Matrix
- ต้องระบุ:
--message-id,--target - ไม่บังคับ:
--limit
-
read- แชนแนล: Discord/Slack/Matrix
- ต้องระบุ:
--target - ไม่บังคับ:
--limit,--before,--after - เฉพาะ Discord:
--around
-
edit- แชนแนล: Discord/Slack/Matrix
- ต้องระบุ:
--message-id,--message,--target
-
delete- แชนแนล: Discord/Slack/Telegram/Matrix
- ต้องระบุ:
--message-id,--target
-
pin/unpin- แชนแนล: Discord/Slack/Matrix
- ต้องระบุ:
--message-id,--target
-
pins(แสดงรายการ)- แชนแนล: Discord/Slack/Matrix
- ต้องระบุ:
--target
-
permissions- แชนแนล: Discord/Matrix
- ต้องระบุ:
--target - เฉพาะ Matrix: ใช้งานได้เมื่อเปิดใช้การเข้ารหัสของ Matrix และอนุญาตการดำเนินการตรวจสอบยืนยัน
-
search- แชนแนล: Discord
- ต้องระบุ:
--guild-id,--query - ไม่บังคับ:
--channel-id,--channel-ids(ระบุซ้ำได้),--author-id,--author-ids(ระบุซ้ำได้),--limit
เธรด
-
thread create- แชนแนล: Discord
- ต้องระบุ:
--thread-name,--target(channel id) - ไม่บังคับ:
--message-id,--message,--auto-archive-min
-
thread list- แชนแนล: Discord
- ต้องระบุ:
--guild-id - ไม่บังคับ:
--channel-id,--include-archived,--before,--limit
-
thread reply- แชนแนล: Discord
- ต้องระบุ:
--target(thread 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(+--guild-idสำหรับ Discord)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; หากไม่ระบุทั้งคู่จะเป็นการล้าง timeout)kick:--guild-id,--user-id(+--reason)ban:--guild-id,--user-id(+--delete-days,--reason)timeoutรองรับ--reasonเช่นกัน
Broadcast
broadcast- แชนแนล: แชนแนลใดก็ได้ที่กำหนดค่าไว้; ใช้
--channel allเพื่อกำหนดเป้าหมายผู้ให้บริการทั้งหมด - ต้องระบุ:
--targets <target...> - ไม่บังคับ:
--message,--media,--dry-run
- แชนแนล: แชนแนลใดก็ได้ที่กำหนดค่าไว้; ใช้
ตัวอย่าง
ส่งการตอบกลับใน Discord:
openclaw message send --channel discord \
--target channel:123 --message "hi" --reply-to 456
ส่งข้อความพร้อมปุ่มเชิงความหมาย:
openclaw message send --channel discord \
--target channel:123 --message "เลือก:" \
--presentation '{"blocks":[{"type":"buttons","buttons":[{"label":"อนุมัติ","value":"approve","style":"success"},{"label":"ปฏิเสธ","value":"decline","style":"danger"}]}]}'
Core จะเรนเดอร์ payload presentation เดียวกันไปเป็นคอมโพเนนต์ของ Discord, blocks ของ Slack, ปุ่ม inline ของ Telegram, props ของ Mattermost หรือการ์ดของ Teams/Feishu ตามความสามารถของแชนแนล ดู Message Presentation สำหรับสัญญาฉบับเต็มและกฎ fallback
ส่ง payload presentation ที่สมบูรณ์ยิ่งขึ้น:
openclaw message send --channel googlechat --target spaces/AAA... \
--message "เลือก:" \
--presentation '{"title":"อนุมัติการ deploy","tone":"warning","blocks":[{"type":"text","text":"เลือกเส้นทาง"},{"type":"buttons","buttons":[{"label":"อนุมัติ","value":"approve"},{"label":"ปฏิเสธ","value":"decline"}]}]}'
สร้าง poll ใน Discord:
openclaw message poll --channel discord \
--target channel:123 \
--poll-question "ของว่าง?" \
--poll-option Pizza --poll-option Sushi \
--poll-multi --poll-duration-hours 48
สร้าง poll ใน Telegram (ปิดอัตโนมัติใน 2 นาที):
openclaw message poll --channel telegram \
--target @mychat \
--poll-question "มื้อกลางวัน?" \
--poll-option Pizza --poll-option Sushi \
--poll-duration-seconds 120 --silent
ส่งข้อความแบบ proactive ใน Teams:
openclaw message send --channel msteams \
--target conversation:19:abc@thread.tacv2 --message "hi"
สร้าง poll ใน Teams:
openclaw message poll --channel msteams \
--target conversation:19:abc@thread.tacv2 \
--poll-question "มื้อกลางวัน?" \
--poll-option Pizza --poll-option Sushi
ใส่ reaction ใน Slack:
openclaw message react --channel slack \
--target C123 --message-id 456 --emoji "✅"
ใส่ reaction ในกลุ่ม Signal:
openclaw message react --channel signal \
--target signal:group:abc123 --message-id 1737630212345 \
--emoji "✅" --target-author-uuid 123e4567-e89b-12d3-a456-426614174000
ส่งปุ่ม inline ของ Telegram ผ่าน presentation แบบทั่วไป:
openclaw message send --channel telegram --target @mychat --message "เลือก:" \
--presentation '{"blocks":[{"type":"buttons","buttons":[{"label":"ใช่","value":"cmd:yes"},{"label":"ไม่","value":"cmd:no"}]}]}'
ส่งการ์ดของ Teams ผ่าน presentation แบบทั่วไป:
openclaw message send --channel msteams \
--target conversation:19:abc@thread.tacv2 \
--presentation '{"title":"อัปเดตสถานะ","blocks":[{"type":"text","text":"การ build เสร็จสมบูรณ์"}]}'
ส่งรูปภาพใน Telegram เป็นเอกสารเพื่อหลีกเลี่ยงการบีบอัด:
openclaw message send --channel telegram --target @mychat \
--media ./diagram.png --force-document