FeishuInboundMapper
public final class FeishuInboundMapper
io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:63–280Feishu 入站 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.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channelId | String | 渠道标识(类型 `String`)。The channel id. |
io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:69–71方法详情Method Detail
extractEventId
public static Optional<String> extractEventId(JsonNode envelope)
设置该参数。
Returns the header.event_id, used by the idempotency store.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envelope | JsonNode | envelope(类型 `JsonNode`)。The envelope. |
Optional<String>io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:74–80extractUrlChallenge
public static Optional<String> extractUrlChallenge(JsonNode envelope)
设置该参数。
Returns the URL verification challenge if the envelope is a verification request.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envelope | JsonNode | envelope(类型 `JsonNode`)。The envelope. |
Optional<String>io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:83–95extractSenderOpenId
public static Optional<String> extractSenderOpenId(JsonNode envelope)
设置该参数。
Returns the event.sender.sender_id.open_id for bot-loop self-detection.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envelope | JsonNode | envelope(类型 `JsonNode`)。The envelope. |
Optional<String>io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:98–109extractTenantKey
public static Optional<String> extractTenantKey(JsonNode envelope)
设置该参数。
Returns the header.tenant_key (multi-tenant id).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envelope | JsonNode | envelope(类型 `JsonNode`)。The envelope. |
Optional<String>io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:112–118map
public Optional<InboundMessage> map(JsonNode envelope)
设置映射。
Maps a decrypted Schema 2.0 envelope into an InboundMessage.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
envelope | JsonNode | envelope(类型 `JsonNode`)。The envelope. |
Optional<InboundMessage>io/agentscope/extensions/channel/feishu/FeishuInboundMapper.java:126–202