DingTalkInboundMapper
public final class DingTalkInboundMapper
io/agentscope/extensions/channel/dingtalk/DingTalkInboundMapper.java:55–232DingTalk 入站 Mapper,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.dingtalk 包。核心成员包括 map、extractMsgId、DingTalkInboundMapper。
Parses a DingTalk bot-message payload (Stream topic /v1.0/im/bot/messages/get or the
HTTP callback body of the same protocol) into an InboundMessage.
Text messages (msgtype=text) map to their content. Media messages (picture /
audio / video / file) map to a neutral marker text plus the ChannelMediaMetadata contract: the downloadCode and per-kind metadata are preserved
verbatim, and exchanging the code for bytes (a server-side API call yielding a temporary
download URL) is left to the application. Note the platform delivers audio/video/file to the
robot in single chat only, not on group @-mention. richText and unknown types are
returned as Optional#empty() so the caller can ack the event without dispatching to
the agent.
Conversation kinds:
-
conversationType="1"→ DM (PeerKind#DIRECT). Peer id = sender staff id. -
conversationType="2"→ group (PeerKind#GROUP). Peer id = conversation id.
Group messages typically arrive only when the bot is @-mentioned (DingTalk's bot SDK
dispatches mention-triggered events only); the leading @bot text is preserved by the
platform in text.content.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public DingTalkInboundMapper(String channelId, String accountId) | 初始化 `DingTalkInboundMapper` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Optional<InboundMessage> map(JsonNode payload) | 设置映射。 Builds an `InboundMessage` from a DingTalk bot-message JSON payload. |
public static Optional<String> extractMsgId(JsonNode payload)static | 设置该参数。 Returns the `msgId` field if present, used by the idempotency store. |
构造器详情Constructor Detail
DingTalkInboundMapper
public DingTalkInboundMapper(String channelId, String accountId)
初始化 DingTalkInboundMapper 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
accountId | String | account 标识(类型 `String`)。The account id. |
io/agentscope/extensions/channel/dingtalk/DingTalkInboundMapper.java:60–63方法详情Method Detail
map
public Optional<InboundMessage> map(JsonNode payload)
设置映射。
Builds an InboundMessage from a DingTalk bot-message JSON payload.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
payload | JsonNode | 负载(类型 `JsonNode`)。The payload. |
Optional<InboundMessage>io/agentscope/extensions/channel/dingtalk/DingTalkInboundMapper.java:71–80extractMsgId
public static Optional<String> extractMsgId(JsonNode payload)
设置该参数。
Returns the msgId field if present, used by the idempotency store.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
payload | JsonNode | 负载(类型 `JsonNode`)。The payload. |
Optional<String>io/agentscope/extensions/channel/dingtalk/DingTalkInboundMapper.java:217–223