slack

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() im.AdapterFactory

NewFactory returns an im.AdapterFactory for Slack channels. Supports "webhook" (Events API) and "websocket" (Socket Mode, default).

Types

type Adapter

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

Adapter implements im.Adapter and im.StreamSender for Slack. It delegates to the Slack LongConnClient for Socket Mode.

func NewAdapter

func NewAdapter(client *LongConnClient, api *slack.Client) *Adapter

NewAdapter creates an adapter backed by a Slack long connection client.

func NewWebhookAdapter

func NewWebhookAdapter(api *slack.Client, signingSecret string) *Adapter

NewWebhookAdapter creates an adapter for Slack Events API via Webhook.

func (*Adapter) DownloadFile

func (a *Adapter) DownloadFile(ctx context.Context, msg *im.IncomingMessage) (io.ReadCloser, string, error)

func (*Adapter) EndStream

func (a *Adapter) EndStream(ctx context.Context, incoming *im.IncomingMessage, streamID string) error

func (*Adapter) FinalizeStream

func (a *Adapter) FinalizeStream(ctx context.Context, incoming *im.IncomingMessage, streamID string, finalContent string) error

func (*Adapter) HandleURLVerification

func (a *Adapter) HandleURLVerification(c *gin.Context) bool

func (*Adapter) ParseCallback

func (a *Adapter) ParseCallback(c *gin.Context) (*im.IncomingMessage, error)

func (*Adapter) Platform

func (a *Adapter) Platform() im.Platform

func (*Adapter) SendReply

func (a *Adapter) SendReply(ctx context.Context, incoming *im.IncomingMessage, reply *im.ReplyMessage) error

func (*Adapter) SendStreamChunk

func (a *Adapter) SendStreamChunk(ctx context.Context, incoming *im.IncomingMessage, streamID string, content string) error

func (*Adapter) StartStream

func (a *Adapter) StartStream(ctx context.Context, incoming *im.IncomingMessage) (string, error)

func (*Adapter) UpdateStreamContent

func (a *Adapter) UpdateStreamContent(ctx context.Context, incoming *im.IncomingMessage, streamID string, fullContent string) error

func (*Adapter) VerifyCallback

func (a *Adapter) VerifyCallback(c *gin.Context) error

type LongConnClient

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

LongConnClient manages a Slack Socket Mode long connection.

func NewLongConnClient

func NewLongConnClient(appToken, botToken string, handler MessageHandler) *LongConnClient

NewLongConnClient creates a Slack long connection client.

func (*LongConnClient) GetAPI

func (c *LongConnClient) GetAPI() *slack.Client

GetAPI returns the underlying slack API client.

func (*LongConnClient) Start

func (c *LongConnClient) Start(ctx context.Context) error

Start begins the WebSocket long connection. It blocks until ctx is cancelled.

type MessageHandler

type MessageHandler func(ctx context.Context, msg *im.IncomingMessage) error

MessageHandler is called when an IM message is received via long connection.

Jump to

Keyboard shortcuts

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