← Back to library

多渠道发送可靠性实战:基于 `sendPayload` 做统一文本+媒体投递

问题/场景:不同渠道发送接口不一致,导致多媒体消息在重试/回放时行为不稳定。前置条件:使用支持 `sendPayload` 的适配器(Discord/Slack/WhatsApp/Zalo 等);具备出站日志。实施步骤:1) 将发送逻辑统一到 `sendPayload`;2) 明确 `mediaUrls` 迭代顺序;3) 配置大文本分块回退;4) 做失败重试演练。关键配置:适配器 `sendPayload` 与 chunk-aware fallback。验证方法:同一负载在多渠道可重复投递且顺序一致。风险与边界:各平台媒体大小/频率限制差异大,需按渠道单独限流。来源归因:PR #30144。

GITHUBDiscovered 2026-03-07Author nohat
Prerequisites
  • Your deployment uses outbound adapters with `sendPayload` support.
  • You can observe delivery logs/metrics per channel.
Steps
  1. Refactor per-channel send branches into one payload contract: text + mediaUrls + metadata.
  2. Ensure adapters iterate media payloads deterministically and preserve message order.
  3. Enable chunk-aware fallback for oversized text payloads on strict channels.
  4. Run fault injection (network timeout / 429) and verify retry path does not duplicate media unexpectedly.
  5. Document per-channel limits and enforce pre-send size checks.
Commands
openclaw gateway status
openclaw gateway restart
git log --oneline -n 5
Verify

Replay tests show consistent cross-channel delivery with expected text fallback behavior.

Caveats
  • Do not assume identical media quota across channels; enforce adapter-specific caps.
  • Outbox recovery semantics may differ by plugin implementation(需验证).
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post