Documentation
¶
Overview ¶
Package slack is the notify adapter for Slack (R-374): a channel adapter (R-373) that posts the events a subscription chooses to the Slack channel that subscription names.
It posts as Pando's own Slack app, with the app's bot token. The app is not made by hand: connecting the adapter creates it from a manifest, gives it Pando's icon and installs it in the workspace (connect.go), so a person pastes one configuration token and chooses Allow. Where Slack cannot send the browser back — a Pando without an https address — the app is made from a prefilled link instead and its bot token pasted back.
An adapter set up before that, with an incoming webhook URL, keeps posting through it, to the one channel the webhook names.
Index ¶
- Constants
- func Info() api.KindInfo
- type Adapter
- func (a *Adapter) BeginAuthorization(ctx context.Context, req api.AuthorizationRequest) (api.Authorization, error)
- func (a *Adapter) Capabilities() api.NotifyCapabilities
- func (a *Adapter) Category() api.Category
- func (a *Adapter) Channels(ctx context.Context, query string) ([]api.NotifyChannel, error)
- func (a *Adapter) CompleteAuthorization(ctx context.Context, req api.AuthorizationCompletion) (api.AuthorizationResult, error)
- func (a *Adapter) Configure(ctx context.Context, raw json.RawMessage) error
- func (a *Adapter) HealthCheck(context.Context) error
- func (a *Adapter) Kind() string
- func (a *Adapter) Notify(ctx context.Context, n api.Notification) error
- type Config
Constants ¶
const ( FieldBotToken = "bot_token" FieldAppID = "app_id" FieldTeamName = "team_name" FieldClientID = "client_id" FieldClientSecret = "client_secret" FieldIconSet = "icon_set" FieldWebhookURL = "webhook_url" )
The credential fields the adapter keeps, all written by Pando when it connects except a webhook URL from before it did.
const Kind = "slack"
Kind is the adapter's kind string.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter posts to Slack.
func (*Adapter) BeginAuthorization ¶
func (a *Adapter) BeginAuthorization(ctx context.Context, req api.AuthorizationRequest) (api.Authorization, error)
BeginAuthorization creates the app and returns Slack's approval screen (web), or the link to create it by hand (manual).
func (*Adapter) Capabilities ¶
func (a *Adapter) Capabilities() api.NotifyCapabilities
Capabilities: a channel adapter whose subscriptions each choose a channel — unless it posts through a webhook, which names the one channel it reaches.
func (*Adapter) Channels ¶
Channels lists the workspace's public channels, and the private ones Pando was invited to, whose names contain query.
func (*Adapter) CompleteAuthorization ¶
func (a *Adapter) CompleteAuthorization(ctx context.Context, req api.AuthorizationCompletion) (api.AuthorizationResult, error)
CompleteAuthorization exchanges the code Slack returned for the bot token (web), or checks a bot token pasted by hand (manual, Code).
func (*Adapter) Configure ¶
Configure reads the configuration core assembled, credentials included. An adapter not connected yet is configured, and not authorized.
func (*Adapter) HealthCheck ¶
HealthCheck succeeds once configured. It does not post: a message to a channel every few minutes would be the outage.