slackbot

package
v1.329.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handlers

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

Handlers provides SlackBot management REST API, implementing app.CustomHandler

func NewHandlers

func NewHandlers(repo repositories.SlackBotRepository) *Handlers

NewHandlers creates a new SlackBot Handlers instance (management API only). Socket Mode event handling is managed separately by SlackSocketManager.

func (*Handlers) GetName

func (h *Handlers) GetName() string

GetName returns the name of this handler for logging

func (*Handlers) RegisterRoutes

func (h *Handlers) RegisterRoutes(e *echo.Echo, _ *app.Server) error

RegisterRoutes registers SlackBot management routes. Implements the app.CustomHandler interface. Note: Slack events are received via Socket Mode (not HTTP webhook).

type SlackSocketManager added in v1.271.0

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

SlackSocketManager discovers registered SlackBots and manages one leader-elected socket worker per bot group:

  • "default": all bots with no custom bot token secret
  • <slackbot-id>: each bot with a custom BotTokenSecretName

func NewSlackSocketManager added in v1.271.0

func NewSlackSocketManager(
	kubeClient kubernetes.Interface,
	namespace string,
	repo repoports.SlackBotRepository,
	eventHandler *controllers.SlackBotEventHandler,
	channelResolver *services.SlackChannelResolver,
	cfg SlackSocketManagerConfig,
) *SlackSocketManager

NewSlackSocketManager creates a new SlackSocketManager

func (*SlackSocketManager) Run added in v1.271.0

func (m *SlackSocketManager) Run(ctx context.Context)

Run starts the reconciliation loop. On each tick, it discovers SlackBots and starts/stops leader-elected socket workers.

func (*SlackSocketManager) Stop added in v1.271.0

func (m *SlackSocketManager) Stop()

Stop cancels all running workers

type SlackSocketManagerConfig added in v1.271.0

type SlackSocketManagerConfig struct {
	DefaultAppTokenSecretName string
	DefaultAppTokenSecretKey  string
	DefaultBotTokenSecretName string
	DefaultBotTokenSecretKey  string
	ReconcileInterval         time.Duration
	LeaderElectionConfig      schedule.LeaderElectionConfig
}

SlackSocketManagerConfig holds configuration for SlackSocketManager

type SlackSocketWorker added in v1.271.0

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

SlackSocketWorker manages one Socket Mode WebSocket connection for a Slack App. For the "default" group (bots with no custom token), botID is "default". For custom bots, botID is the SlackBot entity ID.

func NewSlackSocketWorker added in v1.271.0

func NewSlackSocketWorker(
	botID string,
	appTokenSecretName string,
	appTokenSecretKey string,
	botTokenSecretName string,
	botTokenSecretKey string,
	channelResolver *services.SlackChannelResolver,
	eventHandler *controllers.SlackBotEventHandler,
) *SlackSocketWorker

NewSlackSocketWorker creates a new SlackSocketWorker

func (*SlackSocketWorker) Run added in v1.271.0

func (w *SlackSocketWorker) Run(ctx context.Context)

Run connects to Slack via Socket Mode and processes events until ctx is cancelled. The Slack SDK handles reconnection automatically.

Jump to

Keyboard shortcuts

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