fix(zalo): fix pairing channel detection and webhook payload format #991
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix(zalo): fix pairing channel detection and webhook payload format
Fixes #987
Problem
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.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:
requirePairingAdapter()withgetPairingAdapter()that returnsundefinedfor unknown channels instead of throwingpairingAdapterdirectly to bypass registry lookupsafeChannelKey()to sanitize channel IDs for filenames (prevents path traversal)parseChannel()in CLI to accept valid extension channel names not in core registryWebhook fix:
{ event_name, message }and wrapped{ ok, result }event_nameinstead ofokflagFiles Changed
extensions/zalo/src/monitor.ts- Fix webhook payload parsing, pass pairing adapterextensions/zalo/src/core-bridge.ts- AddpairingAdapterto upsert signaturesrc/channels/plugins/pairing.ts- Accept optionalpairingAdapterparamsrc/pairing/pairing-store.ts- UsegetPairingAdapter(), addsafeChannelKey()src/pairing/pairing-labels.ts- UsegetPairingAdapter()with fallbacksrc/cli/pairing-cli.ts- Allow extension channels inparseChannel()