Class WeComInboundMapper

java.lang.Object
io.agentscope.extensions.channel.wecom.WeComInboundMapper

public final class WeComInboundMapper extends Object
Parses a decrypted WeCom callback XML body into an InboundMessage.

Text messages (MsgType=text, single-user app message) map to their content. Media messages (MsgType image / voice / video) map to a neutral marker text plus the ChannelMediaMetadata contract: the provider material identifiers are preserved verbatim and decoding them (a token-authenticated media/get exchange, valid for three days) is left to the application. Other inbound types (event, location, link, ...) are returned as Optional.empty() so the caller can ack the webhook without dispatching to the agent.

  • Constructor Details

    • WeComInboundMapper

      public WeComInboundMapper(String channelId, String accountId)
  • Method Details

    • map

      public Optional<io.agentscope.harness.agent.gateway.channel.InboundMessage> map(String xml)
      Builds an InboundMessage from a decrypted WeCom message XML. Text messages map to their content; media messages map to a neutral marker plus ChannelMediaMetadata entries. Returns empty for other payload kinds or malformed events so the caller can ack without dispatching.
    • extractMsgId

      public static Optional<String> extractMsgId(String xml)
      Returns the MsgId field if present, used by the idempotency store.