AS AgentScopeAPI 手册 / API Reference

FeishuInboundMapper

public final class FeishuInboundMapper
源码Source io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:63–280

Feishu 入站 Mapper,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.feishu 包。核心成员包括 extractEventId、extractUrlChallenge、extractSenderOpenId、extractTenantKey、map、FeishuInboundMapper。

Parses a decrypted Feishu Event Subscription v2 envelope into an InboundMessage.

Schema 2.0 envelope shape:


{
"schema": "2.0",
"header": {"event_id":"...","event_type":"im.message.receive_v1","tenant_key":"...", ...},
"event": {
"sender": {"sender_id":{"open_id":"...","user_id":"...","union_id":"..."}, "sender_type":"user"},
"message": {
"message_id":"om_...",
"chat_id":"oc_...",
"chat_type":"p2p|group",
"message_type":"text|...",
"content":"{\"text\":\"@_user_1 hello\"}"
}
}
}

Text messages (message_type=text) map to their content; the inner content field is a JSON-encoded string and is re-parsed to read the text field. Media messages (image / file / folder / audio / media) map to a neutral marker text plus the ChannelMediaMetadata contract: the image_key / file_key material identifiers and per-kind metadata are preserved verbatim, and fetching the bytes (a token-authenticated message-resource download) is left to the application. Other message types (post, sticker, interactive, share cards, ...) are returned as Optional#empty() so the caller can ack without dispatching.

构造器摘要Constructor Summary

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

方法摘要Method Summary

方法Method说明Description
public static Optional<String> extractEventId(JsonNode envelope)
static
设置该参数。
Returns the `header.event_id`, used by the idempotency store.
public static Optional<String> extractUrlChallenge(JsonNode envelope)
static
设置该参数。
Returns the URL verification challenge if the envelope is a verification request.
public static Optional<String> extractSenderOpenId(JsonNode envelope)
static
设置该参数。
Returns the `event.sender.sender_id.open_id` for bot-loop self-detection.
public static Optional<String> extractTenantKey(JsonNode envelope)
static
设置该参数。
Returns the `header.tenant_key` (multi-tenant id).
public Optional<InboundMessage> map(JsonNode envelope)
设置映射。
Maps a decrypted Schema 2.0 envelope into an `InboundMessage`.

构造器详情Constructor Detail

FeishuInboundMapper

public FeishuInboundMapper(String channelId)

初始化 FeishuInboundMapper 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
channelIdString渠道标识(类型 `String`)。The channel id.
源码Source io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:69–71

方法详情Method Detail

extractEventId

public static Optional<String> extractEventId(JsonNode envelope)
static

设置该参数。

Returns the header.event_id, used by the idempotency store.

参数Parameters
名称Name类型Type说明Description
envelopeJsonNodeenvelope(类型 `JsonNode`)。The envelope.
返回Returns Optional<String>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:74–80

extractUrlChallenge

public static Optional<String> extractUrlChallenge(JsonNode envelope)
static

设置该参数。

Returns the URL verification challenge if the envelope is a verification request.

参数Parameters
名称Name类型Type说明Description
envelopeJsonNodeenvelope(类型 `JsonNode`)。The envelope.
返回Returns Optional<String>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:83–95

extractSenderOpenId

public static Optional<String> extractSenderOpenId(JsonNode envelope)
static

设置该参数。

Returns the event.sender.sender_id.open_id for bot-loop self-detection.

参数Parameters
名称Name类型Type说明Description
envelopeJsonNodeenvelope(类型 `JsonNode`)。The envelope.
返回Returns Optional<String>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:98–109

extractTenantKey

public static Optional<String> extractTenantKey(JsonNode envelope)
static

设置该参数。

Returns the header.tenant_key (multi-tenant id).

参数Parameters
名称Name类型Type说明Description
envelopeJsonNodeenvelope(类型 `JsonNode`)。The envelope.
返回Returns Optional<String>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:112–118

map

public Optional<InboundMessage> map(JsonNode envelope)

设置映射。

Maps a decrypted Schema 2.0 envelope into an InboundMessage.

参数Parameters
名称Name类型Type说明Description
envelopeJsonNodeenvelope(类型 `JsonNode`)。The envelope.
返回Returns Optional<InboundMessage>
返回可选。Returns optional.
源码Source io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:126–202
基于官方固定版本源码静态生成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.