Documentation
¶
Overview ¶
Package slack provides a Slack bot channel implementation.
Index ¶
- Constants
- type Channel
- func (c *Channel) Info() channel.Info
- func (c *Channel) IsConnected() bool
- func (c *Channel) Messages() <-chan channel.Message
- func (c *Channel) Name() string
- func (c *Channel) OutboundCapabilities() channel.OutboundCapabilities
- func (c *Channel) RegisterBlockActionHandler(actionID string, handler InteractionHandler)
- func (c *Channel) RegisterInteractionHandler(callbackID string, handler InteractionHandler)
- func (c *Channel) RespondToInteraction(ctx context.Context, responseURL string, msg map[string]interface{}) error
- func (c *Channel) Send(ctx context.Context, msg channel.OutgoingMessage) error
- func (c *Channel) SendStreaming(ctx context.Context, chatID string, replyToID string, content <-chan string, ...) error
- func (c *Channel) SetMessageHandler(handler MessageHandler)
- func (c *Channel) SetSessionManager(manager *channel.BotSessionManager)
- func (c *Channel) Start(ctx context.Context) error
- func (c *Channel) Stop(ctx context.Context) error
- func (c *Channel) Type() string
- func (c *Channel) WebhookHandler() http.HandlerFunc
- type InteractionAction
- type InteractionCallback
- type InteractionHandler
- type InteractionSelectedOption
- type MessageHandler
- type Validator
Constants ¶
const SlackAPIBaseURL = "https://slack.com/api"
SlackAPIBaseURL is the base URL for Slack API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct {
// contains filtered or unexported fields
}
func (*Channel) IsConnected ¶
func (*Channel) OutboundCapabilities ¶
func (c *Channel) OutboundCapabilities() channel.OutboundCapabilities
func (*Channel) RegisterBlockActionHandler ¶
func (c *Channel) RegisterBlockActionHandler(actionID string, handler InteractionHandler)
func (*Channel) RegisterInteractionHandler ¶
func (c *Channel) RegisterInteractionHandler(callbackID string, handler InteractionHandler)
func (*Channel) RespondToInteraction ¶
func (c *Channel) RespondToInteraction(ctx context.Context, responseURL string, msg map[string]interface{}) error
RespondToInteraction sends a response via response URL.
func (*Channel) SendStreaming ¶
func (*Channel) SetMessageHandler ¶
func (c *Channel) SetMessageHandler(handler MessageHandler)
func (*Channel) SetSessionManager ¶
func (c *Channel) SetSessionManager(manager *channel.BotSessionManager)
func (*Channel) WebhookHandler ¶
func (c *Channel) WebhookHandler() http.HandlerFunc
WebhookHandler returns an HTTP handler for webhook events.
type InteractionAction ¶
type InteractionAction struct {
ActionID string `json:"action_id"`
BlockID string `json:"block_id"`
Type string `json:"type"`
Value string `json:"value"`
SelectedOption InteractionSelectedOption `json:"selected_option"`
SelectedOptions []InteractionSelectedOption `json:"selected_options"`
}
InteractionAction represents a single action in a Slack interaction payload.
type InteractionCallback ¶
type InteractionCallback struct {
Type string `json:"type"`
TriggerID string `json:"trigger_id"`
CallbackID string `json:"callback_id"`
ResponseURL string `json:"response_url"`
Channel struct {
ID string `json:"id"`
} `json:"channel"`
User struct {
ID string `json:"id"`
Name string `json:"name"`
} `json:"user"`
View struct {
CallbackID string `json:"callback_id"`
} `json:"view"`
Actions []InteractionAction `json:"actions"`
}
InteractionCallback represents a Slack interaction payload.
type InteractionHandler ¶
type InteractionHandler func(ctx context.Context, callback *InteractionCallback) error
type InteractionSelectedOption ¶
type InteractionSelectedOption struct {
Value string `json:"value"`
}
InteractionSelectedOption represents a selected option in a Slack interaction.
type MessageHandler ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator validates Slack bot configuration by calling the auth.test API.
func NewValidatorWithOptions ¶
NewValidatorWithOptions creates a new Slack validator with custom options.
func NewValidatorWithTimeout ¶
NewValidatorWithTimeout creates a new Slack validator with custom timeout.