Class DingTalkInboundMapper
/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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractMsgId(com.fasterxml.jackson.databind.JsonNode payload) Returns themsgIdfield if present, used by the idempotency store.Optional<io.agentscope.harness.agent.gateway.channel.InboundMessage>map(com.fasterxml.jackson.databind.JsonNode payload) Builds anInboundMessagefrom a DingTalk bot-message JSON payload.
-
Constructor Details
-
DingTalkInboundMapper
-
-
Method Details
-
map
public Optional<io.agentscope.harness.agent.gateway.channel.InboundMessage> map(com.fasterxml.jackson.databind.JsonNode payload) Builds anInboundMessagefrom a DingTalk bot-message JSON payload. Text messages map to their content; media messages map to a neutral marker plusChannelMediaMetadataentries. Returns empty for other payload kinds or malformed events so the caller can ack without dispatching. -
extractMsgId
Returns themsgIdfield if present, used by the idempotency store.
-