Polls

Các channel được hỗ trợ

  • WhatsApp (web channel)
  • Discord
  • MS Teams (Adaptive Cards)

CLI

# WhatsApp
openclaw message poll --target +15555550123 \
  --poll-question "Lunch today?" --poll-option "Yes" --poll-option "No" --poll-option "Maybe"
openclaw message poll --target [email protected] \
  --poll-question "Meeting time?" --poll-option "10am" --poll-option "2pm" --poll-option "4pm" --poll-multi

# Discord
openclaw message poll --channel discord --target channel:123456789 \
  --poll-question "Snack?" --poll-option "Pizza" --poll-option "Sushi"
openclaw message poll --channel discord --target channel:123456789 \
  --poll-question "Plan?" --poll-option "A" --poll-option "B" --poll-duration-hours 48

# MS Teams
openclaw message poll --channel msteams --target conversation:19:[email protected] \
  --poll-question "Lunch?" --poll-option "Pizza" --poll-option "Sushi"

Các tùy chọn:

  • --channel: whatsapp (mặc định), discord, hoặc msteams
  • --poll-multi: cho phép chọn nhiều lựa chọn
  • --poll-duration-hours: chỉ dành cho Discord (mặc định là 24 nếu không chỉ định)

Gateway RPC

Method: poll

Params:

  • to (string, bắt buộc)
  • question (string, bắt buộc)
  • options (string[], bắt buộc)
  • maxSelections (number, tùy chọn)
  • durationHours (number, tùy chọn)
  • channel (string, tùy chọn, mặc định: whatsapp)
  • idempotencyKey (string, bắt buộc)

Sự khác biệt giữa các channel

  • WhatsApp: 2-12 lựa chọn, maxSelections phải nằm trong số lượng lựa chọn, bỏ qua durationHours.
  • Discord: 2-10 lựa chọn, durationHours giới hạn từ 1-768 giờ (mặc định 24). maxSelections > 1 bật chế độ multi-select; Discord không hỗ trợ số lượng lựa chọn cố định.
  • MS Teams: Adaptive Card polls (do OpenClaw quản lý). Không có API poll gốc; durationHours bị bỏ qua.

Agent tool (Message)

Dùng tool message với action poll (to, pollQuestion, pollOption, tùy chọn pollMulti, pollDurationHours, channel).

Lưu ý: Discord không có chế độ “chọn đúng N lựa chọn”; pollMulti tương ứng với multi-select. Polls trên Teams được render dưới dạng Adaptive Cards và yêu cầu gateway phải online để ghi lại các vote trong ~/.openclaw/msteams-polls.json.