feishu

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginID    = "channel/feishu"
	RuntimeName = "bot"
)

Variables

This section is empty.

Functions

func DecodeConfig

func DecodeConfig(raw map[string]any) (pkgchannel.FeishuConfig, error)

func NewFeishuManagedRuntime

func NewFeishuManagedRuntime(deps FeishuRuntimeDeps) pkgplugins.Runtime

func RedactConfig

func RedactConfig(raw map[string]any) map[string]any

Types

type Bot

type Bot struct {
	// contains filtered or unexported fields
}

Bot wraps a Feishu bot with agent pool integration.

func New

func New(cfg Config, handler channel.Handler) (*Bot, error)

New creates a Feishu bot. Call Start to begin receiving events.

func (*Bot) Name

func (b *Bot) Name() string

Name returns the backend name. Implements channel.Channel.

func (*Bot) Notify

func (b *Bot) Notify(ctx context.Context, n channel.Notification) error

Notify sends a notification message. Implements channel.Channel. Supports both chat IDs (oc_ prefix) and user open IDs (ou_ prefix).

func (*Bot) Platform added in v0.10.0

func (b *Bot) Platform() string

func (*Bot) Start

func (b *Bot) Start(ctx context.Context) error

Start initializes the API client, registers event handlers, and starts a WebSocket connection. It blocks until ctx is cancelled.

func (*Bot) Stop

func (b *Bot) Stop()

Stop cancels the bot context.

type Config

type Config struct {
	InstanceID        string                 `json:"-"`
	AppID             string                 `json:"app_id"`
	AppSecret         string                 `json:"app_secret"`
	EncryptKey        string                 `json:"encrypt_key"`
	VerificationToken string                 `json:"verification_token"`
	GroupMode         string                 `json:"group_mode"` // "mention" | "always" | "disabled"
	Groups            map[string]GroupConfig `json:"groups"`     // per-group overrides keyed by chat_id
	TenantKey         string                 `json:"tenant_key"`
	AutoProvision     bool                   `json:"auto_provision"`
}

Config holds Feishu bot settings.

type FeishuRuntimeDeps

type FeishuRuntimeDeps struct {
	Parent        context.Context
	Handler       pkgchannel.Handler
	Notifications pkgplugins.ChannelRegistry
	Log           *slog.Logger
	Now           func() time.Time
	NewChannel    func(pkgchannel.FeishuConfig, pkgchannel.Handler) (pkgchannel.Channel, error)
}

type GroupConfig

type GroupConfig struct {
	GroupMode    string   `json:"group_mode"`    // override global group_mode for this group
	SystemPrompt string   `json:"system_prompt"` // prepend to user message in this group
	ToolAllow    []string `json:"tool_allow"`    // reserved: only these tools (not yet enforced)
	ToolDeny     []string `json:"tool_deny"`     // reserved: deny these tools (not yet enforced)
}

GroupConfig holds per-group overrides, keyed by chat_id in Config.Groups.

type TenantProfile added in v0.14.0

type TenantProfile struct {
	UnionID string
	OpenID  string
	Name    string
	Email   string
}

TenantProfile holds the information fetched from the Feishu contact API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL