AS AgentScopeAPI 手册 / API Reference

FeishuChannel

public final class FeishuChannel implements Channel
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:49–284

Feishu 渠道,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.extensions.channel.feishu 包,实现 Channel。核心成员包括 fromProperties、channelId、config、init、start、stop。

Feishu (飞书 / Lark) channel adapter.

Inbound: relies on Spring-managed FeishuCallbackController which receives the URL verification handshake and event-subscription callbacks, optionally decrypts via FeishuCrypto, deduplicates by header.event_id, runs the bot-loop guard, and dispatches into this channel.

Outbound: uses FeishuOutboundClient to call /open-apis/im/v1/messages, authenticating with a tenant_access_token from FeishuAccessTokenProvider.

字段摘要Field Summary

字段Field类型Type说明Description
TYPE
staticfinal
String
类型字段。
`type` value used in `agentscope.json` and `io.agentscope.harness.agent.gateway.channel.ChannelFactory`.

方法摘要Method Summary

方法Method说明Description
public static FeishuChannel fromProperties(String channelId, ChannelConfig routing, Map<String, Object> rawProperties)
static
执行来自属性相关操作。
Factory used by `io.agentscope.harness.agent.gateway.channel.ChannelFactory`.
public static FeishuChannel fromProperties(String channelId, ChannelConfig routing, Map<String, Object> rawProperties, InboundEventDeduplicator idempotency)
static
执行来自属性相关操作。
Factory variant that lets the application supply the `InboundEventDeduplicator` used to drop platform redeliveries — for example a shared-storage implementation so duplicates are recognized across instances.
public static FeishuChannel fromProperties(String channelId, ChannelConfig routing, Map<String, Object> rawProperties, InboundEventDeduplicator idempotency, AccessTokenStore tokenStore)
static
执行来自属性相关操作。
Factory variant that additionally lets the application supply the `AccessTokenStore` caching the outbound access token — for example a shared-storage implementation so one instance's refresh or invalidation serves the whole deployment.
public String channelId()
返回渠道标识。
Returns the channel id.
public ChannelConfig config()
返回配置。
Returns the config.
public void init(Gateway gateway)
初始化 `FeishuChannel` 实例。
Creates a new instance.
public void start()
执行启动相关操作。
Returns the start.
public void stop()
执行停止相关操作。
Returns the stop.
public Mono<Msg> dispatch(InboundMessage message)
设置该参数。
Performs the dispatch operation.
public Mono<String> deliverWithReceipt(OutboundAddress address, Msg message, String deliveryId)
执行 `deliverWithReceipt` 方法。
Performs the deliver with receipt operation.
public void deliver(OutboundAddress address, List<Msg> messages)
执行 `deliver` 方法。
Performs the deliver operation.

字段详情Field Detail

TYPE

public static final String TYPE
staticfinal

类型字段。声明为 public static final String TYPE。

type value used in agentscope.json and io.agentscope.harness.agent.gateway.channel.ChannelFactory.

源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:54

方法详情Method Detail

fromProperties

public static FeishuChannel fromProperties(String channelId, ChannelConfig routing, Map<String, Object> rawProperties)
static

执行来自属性相关操作。

Factory used by io.agentscope.harness.agent.gateway.channel.ChannelFactory.

参数Parameters
名称Name类型Type说明Description
channelIdString渠道标识(类型 `String`)。The channel id.
routingChannelConfig路由(类型 `ChannelConfig`)。The routing.
rawPropertiesMap<String, Object>原始属性(类型 `Map`)。The raw properties.
返回Returns FeishuChannel
返回FeishuChannel。Returns feishu channel.
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:101–109

fromProperties

public static FeishuChannel fromProperties(String channelId, ChannelConfig routing, Map<String, Object> rawProperties, InboundEventDeduplicator idempotency)
static

执行来自属性相关操作。

Factory variant that lets the application supply the InboundEventDeduplicator used to drop platform redeliveries — for example a shared-storage implementation so duplicates are recognized across instances.

参数Parameters
名称Name类型Type说明Description
channelIdString渠道标识(类型 `String`)。The channel id.
routingChannelConfig路由(类型 `ChannelConfig`)。The routing.
rawPropertiesMap<String, Object>原始属性(类型 `Map`)。The raw properties.
idempotencyInboundEventDeduplicatoridempotency(类型 `InboundEventDeduplicator`)。deduplicator for inbound events; must be thread-safe
返回Returns FeishuChannel
返回FeishuChannel。Returns feishu channel.
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:120–127

fromProperties

public static FeishuChannel fromProperties(String channelId, ChannelConfig routing, Map<String, Object> rawProperties, InboundEventDeduplicator idempotency, AccessTokenStore tokenStore)
static

执行来自属性相关操作。

Factory variant that additionally lets the application supply the AccessTokenStore caching the outbound access token — for example a shared-storage implementation so one instance's refresh or invalidation serves the whole deployment.

参数Parameters
名称Name类型Type说明Description
channelIdString渠道标识(密钥 in`agentscope.json#channels`)。the channel id (key in `agentscope.json#channels`)
routingChannelConfig`ChannelConfig`已解析来自文件条目's 路由块。the `ChannelConfig` parsed from the file entry's routing block
rawPropertiesMap<String, Object>原始属性(类型 `Map`)。provider-specific properties (appId, appSecret, encryptKey, ...)
idempotencyInboundEventDeduplicatoridempotency(类型 `InboundEventDeduplicator`)。deduplicator for inbound events; must be thread-safe
tokenStoreAccessTokenStore令牌存储(类型 `AccessTokenStore`)。cache for this channel's access token — one instance per credential, not to be shared across channels with different credentials; must be thread-safe
返回Returns FeishuChannel
返回FeishuChannel。Returns feishu channel.
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:142–167

channelId

public String channelId()

返回渠道标识。

Returns the channel id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:173–176

config

public ChannelConfig config()

返回配置。

Returns the config.

返回Returns ChannelConfig
返回ChannelConfig。Returns channel config.
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:178–181

init

public void init(Gateway gateway)

初始化 FeishuChannel 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
gatewayGateway网关(类型 `Gateway`)。The gateway.
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:183–188

start

public void start()

执行启动相关操作。

Returns the start.

源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:190–199

stop

public void stop()

执行停止相关操作。

Returns the stop.

源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:201–205

dispatch

public Mono<Msg> dispatch(InboundMessage message)

设置该参数。

Performs the dispatch operation.

参数Parameters
名称Name类型Type说明Description
messageInboundMessage消息(类型 `InboundMessage`)。The message.
返回Returns Mono<Msg>
返回Mono。Returns mono.
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:207–223

deliverWithReceipt

public Mono<String> deliverWithReceipt(OutboundAddress address, Msg message, String deliveryId)

执行 deliverWithReceipt 方法。

Performs the deliver with receipt operation.

参数Parameters
名称Name类型Type说明Description
addressOutboundAddressaddress(类型 `OutboundAddress`)。The address.
messageMsg消息(类型 `Msg`)。The message.
deliveryIdStringdelivery 标识(类型 `String`)。The delivery id.
返回Returns Mono<String>
返回Mono。Returns mono.
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:225–229

deliver

public void deliver(OutboundAddress address, List<Msg> messages)

执行 deliver 方法。

Performs the deliver operation.

参数Parameters
名称Name类型Type说明Description
addressOutboundAddressaddress(类型 `OutboundAddress`)。The address.
messagesList<Msg>消息列表(类型 `List`)。The messages.
源码Source io/agentscope/extensions/channel/feishu/FeishuChannel.java:231–245

继承成员Inherited Members

继承自Methods inherited from Channel
基于官方固定版本源码静态生成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.