Skip to content

feat: Add WhatsApp poll support#248

Merged
steipete merged 1 commit intoopenclaw:mainfrom
dbhurley:feat/whatsapp-polls
Jan 6, 2026
Merged

feat: Add WhatsApp poll support#248
steipete merged 1 commit intoopenclaw:mainfrom
dbhurley:feat/whatsapp-polls

Conversation

@dbhurley
Copy link
Copy Markdown
Contributor

@dbhurley dbhurley commented Jan 5, 2026

Summary

Implements #123 - Adds the ability to create WhatsApp polls programmatically via CLI and gateway RPC.

Changes

Gateway Protocol (src/gateway/protocol/)

  • Add PollParamsSchema with validation for:
    • to: Recipient JID (required)
    • question: Poll question (required)
    • options: Array of 2-12 options (required)
    • selectableCount: How many options user can select (default: 1)
    • idempotencyKey: For deduplication (required)

ActiveWebListener (src/web/)

  • Add sendPoll(to, poll) method to the interface
  • Implement in inbound.ts using Baileys:
sock.sendMessage(jid, {
  poll: {
    name: poll.question,
    values: poll.options,
    selectableCount: poll.selectableCount ?? 1,
  },
});

Gateway RPC (src/gateway/server-methods/send.ts)

  • Add poll method handler with validation and idempotency

CLI Command (src/commands/poll.ts, src/cli/program.ts)

clawdbot poll --to "+15555550123" -q "Lunch today?" -o "Yes" -o "No" -o "Maybe"
clawdbot poll --to "[email protected]" -q "Meeting time?" -o "10am" -o "2pm" -s 2 --json

Testing

  • Validated schema exports and types compile
  • CLI command registered with help text and examples
  • Follows existing patterns from send command

Checklist

  • Gateway RPC method added
  • ActiveWebListener interface extended
  • Baileys poll implementation
  • CLI command with options
  • Validation for 2-12 options
  • Idempotency support
  • --dry-run and --json flags

Closes #123

Implements issue #123 - WhatsApp Poll Support

## Gateway Protocol
- Add `poll` RPC method with params: to, question, options (2-12), selectableCount

## ActiveWebListener
- Add `sendPoll(to, poll)` method to interface
- Implementation uses Baileys poll message type

## CLI Command
- `clawdbot poll --to <jid> -q <question> -o <opt1> -o <opt2> [-s count]`
- Supports --dry-run, --json, --verbose flags
- Validates 2-12 options

## Changes
- src/gateway/protocol/schema.ts: Add PollParamsSchema
- src/gateway/protocol/index.ts: Export validator and types
- src/web/active-listener.ts: Add sendPoll to interface
- src/web/inbound.ts: Implement sendPoll using Baileys
- src/web/outbound.ts: Add sendPollWhatsApp function
- src/gateway/server-methods/send.ts: Add poll handler
- src/commands/poll.ts: New CLI command
- src/cli/program.ts: Register poll command

Closes #123
@steipete
Copy link
Copy Markdown
Contributor

steipete commented Jan 6, 2026

This is very cool, thank you!

@steipete
Copy link
Copy Markdown
Contributor

steipete commented Jan 6, 2026

Follow-up (clean summary; my last comment lost inline code formatting).

Thanks again @dbhurley — I built on this PR and implemented the unified approach (shared poll model + per-provider adapters).

Changes landed locally (commit ea38e257):

  • Shared poll normalization/validation: src/polls.ts
  • CLI: clawdbot poll wired in src/cli/program.ts + implementation in src/commands/poll.ts
  • Gateway RPC: new poll method in src/gateway/server-methods/send.ts (provider whatsapp|discord, idempotency)
  • Protocol schema/validators: src/gateway/protocol/schema.ts, src/gateway/protocol/index.ts
  • WhatsApp implementation: ActiveWebListener.sendPoll + Baileys payload in src/web/inbound.ts, adapter in src/web/outbound.ts
  • Discord implementation: sendPollDiscord now consumes shared poll model in src/discord/send.ts (duration clamped; multiselect mapping)
  • Docs + credits: docs/poll.md and CHANGELOG.md (refs Feature Request: WhatsApp Poll Support #123; thanks)

Verification: pnpm lint + pnpm test.

@steipete steipete merged commit 2737e17 into openclaw:main Jan 6, 2026
@steipete
Copy link
Copy Markdown
Contributor

steipete commented Jan 6, 2026

Follow-up: PR #248 is merged, and the poll feature is now unified across providers.

Post-merge follow-ups on main:

  • Unified poll model + adapters (WhatsApp + Discord): commits 0b27964, 35a2140
  • Docs: docs/poll.md
  • Credits: CHANGELOG + README clawtributors thumbnail list updated to include @dbhurley

Thanks again for the original poll plumbing, @dbhurley.

dgarson added a commit to dgarson/clawdbot that referenced this pull request Feb 9, 2026
* gateway: unify exec and tool approval pending state into single ToolApprovalManager

Route legacy exec.approval.request|resolve through canonical ToolApprovalManager
so there is one pending-approval state machine. Add resolveCompat() for legacy
callers that only provide { id, decision } without requestHash. Both legacy and
canonical events emit correctly for exec-origin requests. Anti-stale requestHash
validation remains effective for canonical tool.approval.resolve callers.

* chore: fix import ordering (formatter)

* fix: restrict exec.approval.resolve to exec-only approvals (cross-tool bypass guard)

---------

Co-authored-by: Claude <[email protected]>
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Implements issue openclaw#123 - WhatsApp Poll Support

## Gateway Protocol
- Add `poll` RPC method with params: to, question, options (2-12), selectableCount

## ActiveWebListener
- Add `sendPoll(to, poll)` method to interface
- Implementation uses Baileys poll message type

## CLI Command
- `clawdbot poll --to <jid> -q <question> -o <opt1> -o <opt2> [-s count]`
- Supports --dry-run, --json, --verbose flags
- Validates 2-12 options

## Changes
- src/gateway/protocol/schema.ts: Add PollParamsSchema
- src/gateway/protocol/index.ts: Export validator and types
- src/web/active-listener.ts: Add sendPoll to interface
- src/web/inbound.ts: Implement sendPoll using Baileys
- src/web/outbound.ts: Add sendPollWhatsApp function
- src/gateway/server-methods/send.ts: Add poll handler
- src/commands/poll.ts: New CLI command
- src/cli/program.ts: Register poll command

Closes openclaw#123
GGzili pushed a commit to GGzili/moltbot that referenced this pull request Mar 16, 2026
67d6e403d Merge pull request openclaw#352 from Zhumin-lv-wn/fix/card-finalize-use-accumulated-content
bddb4427f fix(card): fix AI Card streaming finalization bugs
c535af6c5 Merge pull request openclaw#350 from Zhumin-lv-wn/fix/card-finalize-use-accumulated-content
d044bf291 fix(card): fix AI Card streaming finalization bugs
de7b25ced Merge pull request openclaw#344 from ming1523/pr/dingtalk-thinking-reaction-clean-main-20260315
c66604576 test(dingtalk): 补充 emoji 模式说明与测试
ca98030cf merge(main): 同步最新主线并清理 PR344 冲突
60071fc60 refactor(dingtalk): 收敛 ack reaction API 调用
0babd7cbe chore(todo): regroup PRs under task checklist items
27922ce76 fix(dingtalk): 补齐 ackReaction review 收尾
e7998195b feat(dingtalk): 支持 ackReaction emoji 模式
094b6bd15 merge(main): 解决 PR344 与主线冲突
110d12deb test(dingtalk): 补强 ackReaction 自定义文本覆盖
8b8fd1482 feat(dingtalk): align ack reaction config with official docs
3c86d7a72 Merge pull request openclaw#348 from Zhumin-lv-wn/fix/card-finalize-use-accumulated-content
9f20a89f8 test(card): verify finalize uses accumulated content across multi-turn tool calls
12762e872 fix(card): use accumulated content for AI Card finalization
f2bd84788 chore(todo): align latest issue/pr findings into existing hierarchy
00a80263a Merge pull request openclaw#346 from aoxiaotian-ai/fix/inbound-handler-textToSend-type
a2a897ab1 fix(inbound-handler): guard textToSend undefined in card final/tool deliver
50e44f212 Merge pull request openclaw#313 from bkloveming/fix/peer-id-lazy-preload-for-delivery-queue
04e3b98c8 Merge pull request openclaw#311 from LazyBug1E0CF/fix/dingtalk-reply-media
bb6da5d38 test: cover inbound reply media delivery paths
883a7931a fix: deliver MEDIA attachments in inbound reply handler
418a4b450 Merge pull request openclaw#341 from Zhumin-lv-wn/perf/streaming-response-optimization
2f1d906b8 fix: retry peer-id preload on top-level failures
9ede8d331 fix: harden peer-id preload idempotency and coverage
413517940 fix: lazy-preload peer ID registry to fix 400 errors in delivery queue
e29e36072 Merge pull request openclaw#343 from soimy/codex/fix-dingtalk-idle-reconnect
dc1f5194e Merge pull request openclaw#248 from androidshu/codex/fix-action-send-mediaurl-upload
e22a8b781 test(integration): cover actions.send mediaUrl redirect upload chain
fb626f1b4 Merge remote-tracking branch 'origin/main' into codex/pr-248
d1c012877 fix(dingtalk): harden mediaUrl prepare and redirect DNS pinning
332cddd23 feat(dingtalk): parse pdf/docx text into context (openclaw#298)
d435be58c fix: address copilot review feedback
34edb2178 fix: restore connection manager heartbeat monitoring
db3071c3e fix: stabilize dingtalk stream reconnect baseline
95a3fbbd8 fix: add curly braces for early returns (lint curly rule)
a691fe2dc Merge branch 'soimy:main' into perf/streaming-response-optimization
dee2ad1eb docs: clarify thinking always streams; add answerPrefix threshold tests
298cea5e1 fix: answerPrefix threshold and disableBlockStreaming condition
0579f1281 feat(dingtalk): add AI Card streaming optimization with CardDraftController
2aec0034e Revert "Merge pull request openclaw#332 from ming1523/pr/dingtalk-thinking-reaction-main-20260314"
ee259200c Merge pull request openclaw#332 from ming1523/pr/dingtalk-thinking-reaction-main-20260314
b0f4f7762 fix(dingtalk): prefer thinking reaction feedback
41abbc12a fix(dingtalk): tighten thinking reaction gating
06a6f5d0f feat(dingtalk): add native thinking reaction feedback
5970a7af1 chore(todo): align latest issue/pr findings into existing hierarchy
862bfca8f fix: add connection manager heartbeat
e30c2f0da refactor: remove unsupported socket idle reconnect path
bf4a1233c fix: avoid idle reconnects on quiet stream connections
e49cd9f44 Revert "feat(dingtalk): 增加异步回执模式" (openclaw#334)
54dff048e chore: add .playwright to .gitignore for generated files
e76461b29 chore(todo): align latest issue/pr findings into existing hierarchy
3aea182c6 Merge pull request openclaw#231 from huww98/fix/stop-reason
c296ff109 Merge pull request openclaw#295 from ming1523/pr/async-mode-connector-borrow-20260311
bcfd1db7d fix: don't supress stop reason
e00f8f324 docs: add README table of contents
53fe911fd Merge remote-tracking branch 'origin/main' into pr-check-295
79f583443 fix(dingtalk): keep control aliases off async path
4ac48703b fix(dingtalk): force markdown replies in async mode
cfda4c05c docs(dingtalk): trim unrelated README drift from async ack PR
a9198437a fix(dingtalk): keep async inflight lock until completion
97638c7cf fix(dingtalk): tighten async ack delivery semantics
061305ef2 fix(dingtalk): import async mode config type
84f092c80 feat(dingtalk): add async ack mode for inbound messages

git-subtree-dir: extensions/dingtalk
git-subtree-split: 67d6e403db157e08d7658186756c4cbd16f9fd0c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: WhatsApp Poll Support

2 participants