Documentation
¶
Overview ¶
Package slack implements the Slack channel for DevClaw using the Slack Web API and Socket Mode for real-time events — no external dependencies beyond HTTP.
Features:
- Socket Mode for receiving events (no public URL needed)
- Send/receive text, images, files
- Thread support (reply in thread)
- Reactions (emoji)
- Typing indicators
- Channel/DM/group support
- File upload/download
Index ¶
- type Config
- type Slack
- func (s *Slack) Connect(ctx context.Context) error
- func (s *Slack) Disconnect() error
- func (s *Slack) DownloadMedia(ctx context.Context, msg *channels.IncomingMessage) ([]byte, string, error)
- func (s *Slack) Health() channels.HealthStatus
- func (s *Slack) IsConnected() bool
- func (s *Slack) MarkRead(ctx context.Context, chatID string, messageIDs []string) error
- func (s *Slack) Name() string
- func (s *Slack) Receive() <-chan *channels.IncomingMessage
- func (s *Slack) Send(ctx context.Context, to string, message *channels.OutgoingMessage) error
- func (s *Slack) SendMedia(ctx context.Context, to string, media *channels.MediaMessage) error
- func (s *Slack) SendPresence(ctx context.Context, available bool) error
- func (s *Slack) SendReaction(ctx context.Context, chatID, messageID, emoji string) error
- func (s *Slack) SendTyping(ctx context.Context, to string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// BotToken is the Slack Bot User OAuth Token (xoxb-...).
BotToken string `yaml:"bot_token"`
// AppToken is the Slack App-Level Token for Socket Mode (xapp-...).
AppToken string `yaml:"app_token"`
// AllowedChannels restricts which channel IDs the bot responds in.
// Empty means respond in all channels.
AllowedChannels []string `yaml:"allowed_channels"`
// RespondToThreads enables responding inside threads.
RespondToThreads bool `yaml:"respond_to_threads"`
// ReplyInThread always replies in a thread (vs. in-channel).
ReplyInThread bool `yaml:"reply_in_thread"`
// SendTyping sends typing indicators while processing.
SendTyping bool `yaml:"send_typing"`
}
Config holds Slack channel configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults.
type Slack ¶
type Slack struct {
// contains filtered or unexported fields
}
Slack implements channels.Channel, channels.MediaChannel, channels.PresenceChannel, and channels.ReactionChannel.
func (*Slack) Disconnect ¶
Disconnect stops the Socket Mode connection.
func (*Slack) DownloadMedia ¶
func (s *Slack) DownloadMedia(ctx context.Context, msg *channels.IncomingMessage) ([]byte, string, error)
DownloadMedia downloads a file from an incoming message.
func (*Slack) Health ¶
func (s *Slack) Health() channels.HealthStatus
Health returns the channel health status.
func (*Slack) IsConnected ¶
IsConnected returns true if the bot is connected.
func (*Slack) Receive ¶
func (s *Slack) Receive() <-chan *channels.IncomingMessage
Receive returns the incoming messages channel.
func (*Slack) SendPresence ¶
SendPresence updates the bot's presence.
func (*Slack) SendReaction ¶
SendReaction adds a reaction emoji to a message.