AS AgentScopeAPI 手册 / API Reference

WeComInboundMapper

public final class WeComInboundMapper
源码Source io/agentscope/extensions/channel/wecom/WeComInboundMapper.java:50–204

WeCom 入站 Mapper,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.wecom 包。核心成员包括 map、extractMsgId、WeComInboundMapper。

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 Summary

构造器Constructor说明Description
public WeComInboundMapper(String channelId, String accountId)
初始化 `WeComInboundMapper` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Optional<InboundMessage> map(String xml)
构建`InboundMessage`来自已解密 WeCom 消息 XML。
Builds an `InboundMessage` from a decrypted WeCom message XML.
public static Optional<String> extractMsgId(String xml)
static
设置该参数。
Returns the `MsgId` field if present, used by the idempotency store.

构造器详情Constructor Detail

WeComInboundMapper

public WeComInboundMapper(String channelId, String accountId)

初始化 WeComInboundMapper 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
channelIdString渠道标识(类型 `String`)。The channel id.
accountIdStringaccount 标识(类型 `String`)。The account id.
源码Source io/agentscope/extensions/channel/wecom/WeComInboundMapper.java:57–60

方法详情Method Detail

map

public Optional<InboundMessage> map(String xml)

构建InboundMessage来自已解密 WeCom 消息 XML。

Builds an InboundMessage from a decrypted WeCom message XML.

参数Parameters
名称Name类型Type说明Description
xmlStringXML(类型 `String`)。The xml.
返回Returns Optional<InboundMessage>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/wecom/WeComInboundMapper.java:68–82

extractMsgId

public static Optional<String> extractMsgId(String xml)
static

设置该参数。

Returns the MsgId field if present, used by the idempotency store.

参数Parameters
名称Name类型Type说明Description
xmlStringXML(类型 `String`)。The xml.
返回Returns Optional<String>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/wecom/WeComInboundMapper.java:170–179
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.