Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@longmaba
Copy link
Contributor

fix(zalo): fix pairing channel detection and webhook payload format

Fixes #987

Problem

  1. Pairing flow failed for Zalo - The pairing system used requirePairingAdapter() which threw errors for extension channels like Zalo that aren't in the core registry.

  2. Webhook returned 400 Bad Request - The webhook handler expected payloads wrapped as { ok: true, result: ZaloUpdate }, but Zalo sends updates directly as { event_name, message, ... }.

Changes

Pairing fixes:

  • Replace requirePairingAdapter() with getPairingAdapter() that returns undefined for unknown channels instead of throwing
  • Allow extension channels to pass their pairingAdapter directly to bypass registry lookup
  • Add safeChannelKey() to sanitize channel IDs for filenames (prevents path traversal)
  • Update parseChannel() in CLI to accept valid extension channel names not in core registry

Webhook fix:

  • Handle both payload formats: direct { event_name, message } and wrapped { ok, result }
  • Validate presence of event_name instead of ok flag

Files Changed

  • extensions/zalo/src/monitor.ts - Fix webhook payload parsing, pass pairing adapter
  • extensions/zalo/src/core-bridge.ts - Add pairingAdapter to upsert signature
  • src/channels/plugins/pairing.ts - Accept optional pairingAdapter param
  • src/pairing/pairing-store.ts - Use getPairingAdapter(), add safeChannelKey()
  • src/pairing/pairing-labels.ts - Use getPairingAdapter() with fallback
  • src/cli/pairing-cli.ts - Allow extension channels in parseChannel()

@steipete steipete merged commit a057b3c into openclaw:main Jan 16, 2026
19 of 22 checks passed
@steipete
Copy link
Contributor

Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: 1656f491f97c5cf68ee257e2a165a9a47ffb0b37\n- Merge commit: a057b3c\n\nThanks @longmaba!

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.

[Bug]: Extension channels (like Zalo) cannot use the core pairing system

2 participants