slack

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 8 Imported by: 1

Documentation

Overview

Package slack provides a Slack provider for omnichat using Socket Mode.

Index

Constants

View Source
const (
	// MetaUnfurlLinks controls whether to unfurl text-based links.
	// Value: bool (default: true for markdown format, false otherwise)
	MetaUnfurlLinks = "slack_unfurl_links"

	// MetaUnfurlMedia controls whether to unfurl media-based links.
	// Value: bool (default: true)
	MetaUnfurlMedia = "slack_unfurl_media"

	// MetaReplyBroadcast controls whether to broadcast a thread reply to the channel.
	// Value: bool (default: false)
	// Only applies when ReplyTo is set (i.e., replying in a thread).
	MetaReplyBroadcast = "slack_reply_broadcast"
)

Slack-specific metadata keys for OutgoingMessage.Metadata.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// BotToken is the Slack bot token (xoxb-...).
	BotToken string

	// AppToken is the Slack app-level token for Socket Mode (xapp-...).
	AppToken string

	// Logger is the logger instance.
	Logger *slog.Logger

	// Debug enables debug logging for the Slack client.
	Debug bool
}

Config configures the Slack provider.

type Provider

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

Provider implements the Provider interface for Slack.

func New

func New(config Config) (*Provider, error)

New creates a new Slack provider.

func (*Provider) Connect

func (p *Provider) Connect(ctx context.Context) error

Connect establishes connection to Slack via Socket Mode.

func (*Provider) Disconnect

func (p *Provider) Disconnect(ctx context.Context) error

Disconnect closes the Slack connection.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

func (*Provider) OnEvent

func (p *Provider) OnEvent(handler provider.EventHandler)

OnEvent registers an event handler.

func (*Provider) OnMessage

func (p *Provider) OnMessage(handler provider.MessageHandler)

OnMessage registers a message handler.

func (*Provider) Send

func (p *Provider) Send(ctx context.Context, channelID string, msg provider.OutgoingMessage) error

Send sends a message to a Slack channel.

Jump to

Keyboard shortcuts

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