slack

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DestTypeSlackDirectMessage = "builtin-slack-dm"
	DestTypeSlackChannel       = "builtin-slack-channel"
	DestTypeSlackUsergroup     = "builtin-slack-usergroup"

	FieldSlackUserID      = "slack_user_id"
	FieldSlackChannelID   = "slack_channel_id"
	FieldSlackUsergroupID = "slack_usergroup_id"

	FallbackIconURL = "builtin://slack"
)

Variables

This section is empty.

Functions

func NewChannelDest added in v0.33.0

func NewChannelDest(id string) gadb.DestV1

func NewDirectMessageDest added in v0.33.0

func NewDirectMessageDest(id string) gadb.DestV1

func NewUsergroupDest added in v0.33.0

func NewUsergroupDest(groupID, channelID string) gadb.DestV1

func Signature added in v0.30.1

func Signature(signingSecret string, ts time.Time, data []byte) string

Signature generates a signature for a Slack request.

Types

type Channel

type Channel struct {
	ID     string
	Name   string
	TeamID string

	IsArchived bool
}

Channel contains information about a Slack channel.

func (Channel) AsField added in v0.33.0

func (c Channel) AsField() nfydest.FieldValue

type ChannelSender

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

func NewChannelSender

func NewChannelSender(ctx context.Context, cfg Config) (*ChannelSender, error)

func (*ChannelSender) Channel

func (s *ChannelSender) Channel(ctx context.Context, channelID string) (*Channel, error)

Channel will lookup a single Slack channel for the bot.

func (*ChannelSender) DMSender added in v0.31.0

func (s *ChannelSender) DMSender() *DMSender

DMSender returns a new DMSender wrapping the given ChannelSender.

func (*ChannelSender) DisplayInfo added in v0.33.0

func (s *ChannelSender) DisplayInfo(ctx context.Context, args map[string]string) (*nfydest.DisplayInfo, error)

func (*ChannelSender) FieldLabel added in v0.33.0

func (s *ChannelSender) FieldLabel(ctx context.Context, fieldID, value string) (string, error)

func (*ChannelSender) ID added in v0.33.0

func (s *ChannelSender) ID() string

func (*ChannelSender) ListChannels

func (s *ChannelSender) ListChannels(ctx context.Context) ([]Channel, error)

ListChannels will return a list of channels visible to the slack bot.

func (*ChannelSender) ListUserGroups added in v0.31.0

func (s *ChannelSender) ListUserGroups(ctx context.Context) ([]UserGroup, error)

ListUserGroups will return a list of all Slack user groups.

func (*ChannelSender) SearchField added in v0.33.0

func (s *ChannelSender) SearchField(ctx context.Context, fieldID string, options nfydest.SearchOptions) (*nfydest.SearchResult, error)

func (*ChannelSender) SendMessage added in v0.33.0

func (*ChannelSender) ServeMessageAction added in v0.29.0

func (s *ChannelSender) ServeMessageAction(w http.ResponseWriter, req *http.Request)

func (*ChannelSender) SetReceiver added in v0.29.0

func (s *ChannelSender) SetReceiver(r notification.Receiver)

func (*ChannelSender) Team added in v0.32.0

func (s *ChannelSender) Team(ctx context.Context, id string) (t *Team, err error)

func (*ChannelSender) TeamID added in v0.28.0

func (s *ChannelSender) TeamID(ctx context.Context) (string, error)

func (*ChannelSender) TypeInfo added in v0.33.0

func (s *ChannelSender) TypeInfo(ctx context.Context) (*nfydest.TypeInfo, error)

func (*ChannelSender) User added in v0.31.0

func (s *ChannelSender) User(ctx context.Context, id string) (*User, error)

User will lookup a single Slack user.

func (*ChannelSender) UserGroup added in v0.31.0

func (s *ChannelSender) UserGroup(ctx context.Context, id string) (*UserGroup, error)

User will lookup a single Slack user group.

func (*ChannelSender) UserGroupSender added in v0.31.0

func (s *ChannelSender) UserGroupSender() *UserGroupSender

UserGroupSender returns a new UserGroupSender wrapping the given ChannelSender.

func (*ChannelSender) ValidateChannel added in v0.33.0

func (s *ChannelSender) ValidateChannel(ctx context.Context, id string) error

func (*ChannelSender) ValidateField added in v0.33.0

func (s *ChannelSender) ValidateField(ctx context.Context, fieldID, value string) error

func (*ChannelSender) ValidateUser added in v0.33.0

func (s *ChannelSender) ValidateUser(ctx context.Context, id string) error

func (*ChannelSender) ValidateUserGroup added in v0.33.0

func (s *ChannelSender) ValidateUserGroup(ctx context.Context, id string) error

type Config

type Config struct {
	BaseURL   string
	UserStore *user.Store
}

Config contains values used for the Slack notification sender.

type DMSender added in v0.31.0

type DMSender struct {
	*ChannelSender
}

DMSender wraps a ChannelSender with DM-specific functionality.

func (*DMSender) DisplayInfo added in v0.33.0

func (dm *DMSender) DisplayInfo(ctx context.Context, args map[string]string) (*nfydest.DisplayInfo, error)

func (*DMSender) ID added in v0.33.0

func (dm *DMSender) ID() string

func (*DMSender) TypeInfo added in v0.33.0

func (dm *DMSender) TypeInfo(ctx context.Context) (*nfydest.TypeInfo, error)

func (*DMSender) ValidateField added in v0.33.0

func (dm *DMSender) ValidateField(ctx context.Context, fieldID, value string) error

type Team added in v0.32.0

type Team struct {
	ID      string
	Domain  string
	Name    string
	IconURL string
}

Team contains information about a Slack team.

func (t Team) ChannelLink(id string) string
func (t Team) UserLink(id string) string

type User added in v0.31.0

type User struct {
	ID     string
	Name   string
	TeamID string
}

User contains information about a Slack user.

type UserGroup added in v0.31.0

type UserGroup struct {
	ID     string
	TeamID string
	Name   string
	Handle string
}

func (UserGroup) AsField added in v0.33.0

func (ug UserGroup) AsField() nfydest.FieldValue

type UserGroupSender added in v0.31.0

type UserGroupSender struct {
	*ChannelSender
}

UserGroupSender processes on-call notifications by updating the members of a Slack user group.

func (*UserGroupSender) DisplayInfo added in v0.33.0

func (ug *UserGroupSender) DisplayInfo(ctx context.Context, args map[string]string) (*nfydest.DisplayInfo, error)

func (*UserGroupSender) FieldLabel added in v0.33.0

func (ug *UserGroupSender) FieldLabel(ctx context.Context, fieldID, value string) (string, error)

func (*UserGroupSender) ID added in v0.33.0

func (ug *UserGroupSender) ID() string

func (*UserGroupSender) SearchField added in v0.33.0

func (ug *UserGroupSender) SearchField(ctx context.Context, fieldID string, options nfydest.SearchOptions) (*nfydest.SearchResult, error)

func (*UserGroupSender) SendMessage added in v0.33.0

Send implements notification.Sender.

func (*UserGroupSender) TypeInfo added in v0.33.0

func (ug *UserGroupSender) TypeInfo(ctx context.Context) (*nfydest.TypeInfo, error)

func (*UserGroupSender) ValidateField added in v0.33.0

func (ug *UserGroupSender) ValidateField(ctx context.Context, fieldID, value string) error

Jump to

Keyboard shortcuts

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