slack

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSignatureVerificationFilter

func NewSignatureVerificationFilter(
	config SignatureVerificationFilterConfig,
) libHTTP.Filter

NewSignatureVerificationFilter returns a component that implements the http.Filter interface and can conditionally allow or disallow a request based on the ability to verify the signature of the inbound request.

func NewSlashCommandHandler

func NewSlashCommandHandler(service SlashCommandService) http.Handler

NewSlashCommandHandler returns an implementation of the http.Handler interface that can handle slash commands from Slack by delegating to a transport-agnostic Service interface.

Types

type SignatureVerificationFilterConfig

type SignatureVerificationFilterConfig struct {
	// SlackApps is a map of Slack App configurations indexed by App ID.
	SlackApps map[string]slack.App
}

SignatureVerificationFilterConfig encapsulates configuration for the signature verification based auth filter.

type SlashCommand

type SlashCommand struct {
	TeamID         string `json:"teamID"`         // e.g. T0001
	TeamDomain     string `json:"teamDomain"`     // e.g. example
	EnterpriseID   string `json:"enterpriseID"`   // e.g. E0001
	EnterpriseName string `json:"enterpriseName"` // e.g. Globular%20Construct%20Inc
	ChannelID      string `json:"channelID"`      // e.g. C2147483705
	ChannelName    string `json:"channelName"`    // e.g. test
	UserID         string `json:"userID"`         // e.g. U2147483697
	Command        string `json:"command"`        // e.g. /weather
	Text           string `json:"text"`           // e.g. 94070
	ResponseURL    string `json:"responseURL"`    // e.g. https://hooks.slack.com/commands/1234/5678
	TriggerID      string `json:"triggerID"`      // e.g. 13345224609.738474920.8088930838d88f008e0
	APIAppID       string `json:"apiAppID"`       // e.g. A123456
}

SlashCommand encapsulates details of a Slack slash command.

nolint: lll

type SlashCommandService

type SlashCommandService interface {
	// Handle handles a slash command from Slack.
	Handle(context.Context, SlashCommand) ([]byte, error)
}

SlashCommandService is an interface for components that can handle slash commands from Slack. Implementations of this interface are transport-agnostic.

func NewSlashCommandService

func NewSlashCommandService(
	eventsClient sdk.EventsClient,
) (SlashCommandService, error)

NewSlashCommandService returns an implementation of the Service interface for handling slash commands from Slack.

Jump to

Keyboard shortcuts

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