Documentation
¶
Index ¶
- Constants
- Variables
- func DateOptToTime(opt string) (time.Time, error)
- func DeleteMsg(client *slack.Client, channelID, timestamp, responseURL string) error
- func DownloadAndReadCSV(userClient *slack.Client, urlPrivateDownload string) ([][]string, error)
- func EmailsToSlackIDs(client *slack.Client, emails []string) ([]string, error)
- func EmailsToSlackIDsInclusive(client *slack.Client, emails []string) ([][]string, error)
- func GetChannelMemberEmails(client *slack.Client, channelID string) ([]string, error)
- func GetChannelMembers(client *slack.Client, channelID string) ([]string, error)
- func InteractionCallback(ctx context.Context) (*slack.InteractionCallback, error)
- func NewButton(actionID, value string, text string, style slack.Style) *slack.ButtonBlockElement
- func NewDatePickerWithOpts(actionID string, placeholder *slack.TextBlockObject, initialDate time.Time) *slack.DatePickerBlockElement
- func NewTextBlock(body string, accessory *slack.Accessory) *slack.SectionBlock
- func PostEphemeralMsg(client *slack.Client, msg Msg, channelID, userID string) error
- func PostMsg(client *slack.Client, msg Msg, channelID string) (string, error)
- func PostThreadMsg(client *slack.Client, msg Msg, channelID string, threadTs string) error
- func ReplaceOriginal(w http.ResponseWriter, msg slack.Message) error
- func SendEmptyOK(w http.ResponseWriter)
- func SendOKAndDeleteOriginal(w http.ResponseWriter) error
- func SendResp(w http.ResponseWriter, msg slack.Message) error
- func SlashCommand(ctx context.Context) (*slack.SlashCommand, error)
- func UpdateMsg(client *slack.Client, msg Msg, channelID, timestamp string) error
- func VerifyInteractionCallback(signingSecret string, succeed verifySucceedCallback, fail verifyFail) func(next http.Handler) http.Handler
- func VerifySlashCommand(signingSecret string, succeed verifySucceedSlash, fail verifyFail) func(next http.Handler) http.Handler
- type Channel
- type Msg
Constants ¶
const ( CancelActionID = "cancel_action" CancelBlockID = "cancel_block" )
const ChannelNameMaxLen = 21
ChannelNameMaxLen is the max character length for a Slack channel name
Variables ¶
var ( DoneBtn = NewButton(CancelActionID, "done", "Done", slack.StylePrimary) CancelBtn = NewButton(CancelActionID, "cancel", "Cancel", slack.StyleDanger) )
var DivBlock = slack.NewDividerBlock()
var ErrInvalidCSV = errors.New("received invalid/empty CSV file")
var ErrNoUsersInWorkplace = errors.New("no users in workplace")
Functions ¶
func DateOptToTime ¶ added in v0.3.0
DateOptToTime parses the selected date opt back to time.Time, but owing to its format will always initialize to zero time for everything more granular than a day. Add time.Duration as needed in downstream packages
func DeleteMsg ¶ added in v0.7.0
DeleteMsg deletes the provided message in the channel designated by channelID
func DownloadAndReadCSV ¶ added in v0.4.0
DownloadAndReadCSV downloads a CSV file from urlPrivateDownload and returns the CSV rows. Requires the files:read scope on the user client and the calling user must have access to the file.
func EmailsToSlackIDs ¶ added in v0.5.0
EmailsToSlackIDs takes in an array of email addresses and finds the IDs of any workplace members with those emails
func EmailsToSlackIDsInclusive ¶ added in v0.5.0
EmailToSlackIDsInclusive takes in an array of email addresses, finds the IDs of any workplace members with those emails, and returns both values
func GetChannelMemberEmails ¶ added in v0.5.0
GetChannelMemberEmails returns a list of emails for members of a given channel
func GetChannelMembers ¶ added in v0.5.0
GetChannelMembers returns a list of members for a given channel
func InteractionCallback ¶ added in v0.10.0
func InteractionCallback(ctx context.Context) (*slack.InteractionCallback, error)
InteractionCallback retrieves the verified interaction callback from the context. To utilize this functionality, you must use the VerifyInteractionCallback middleware.
func NewButton ¶ added in v0.8.0
NewButton returns a new ButtonBlockElement set to the designated style
func NewDatePickerWithOpts ¶ added in v0.2.1
func NewDatePickerWithOpts(actionID string, placeholder *slack.TextBlockObject, initialDate time.Time) *slack.DatePickerBlockElement
NewDatePickerWithOpts returns a new DatePickerBlockElement initialized with its date/placeholder text set as specified by one of the two parameters
func NewTextBlock ¶ added in v0.8.0
func NewTextBlock(body string, accessory *slack.Accessory) *slack.SectionBlock
NewTextBlock returns a section block of common configuration.
func PostEphemeralMsg ¶ added in v0.7.0
PostEphemeralMsg sends an ephemeral message in the channel designated by channelID
func PostThreadMsg ¶
PostThreadMsg posts a message response into an existing thread
func ReplaceOriginal ¶
func ReplaceOriginal(w http.ResponseWriter, msg slack.Message) error
ReplaceOriginal replaces the original message with the newly encoded one NOTE: cannot be used in callback from block messages
func SendOKAndDeleteOriginal ¶
func SendOKAndDeleteOriginal(w http.ResponseWriter) error
SendOKAndDeleteOriginal responds with status 200 and deletes the original message NOTE: cannot be used in callback from block messages
func SendResp ¶
func SendResp(w http.ResponseWriter, msg slack.Message) error
SendResp can be used to send simple callback responses NOTE: cannot be used in callback from block messages
func SlashCommand ¶ added in v0.10.0
func SlashCommand(ctx context.Context) (*slack.SlashCommand, error)
SlashCommand retrieves the verified slash command from the context. To utilize this functionality, you must use the VerifySlashCommand middleware.
func VerifyInteractionCallback ¶ added in v0.10.0
func VerifyInteractionCallback(signingSecret string, succeed verifySucceedCallback, fail verifyFail) func(next http.Handler) http.Handler
VerifyInteractionCallback is a middleware that will automatically verify the authenticity of the incoming request and embed the unmarshalled InteractionCallback in the context on success. Use the optional succeed/fail parameters to configure additional behavior on sucess/failure, or simply provide nil if no further action is required.
func VerifySlashCommand ¶ added in v0.10.0
func VerifySlashCommand(signingSecret string, succeed verifySucceedSlash, fail verifyFail) func(next http.Handler) http.Handler
VerifySlashCommand is a middleware that will automatically verify the authenticity of the incoming request and embed the unmarshalled SlashCommand in the context on success. Use the optional succeed/fail parameters to configure additional behavior on sucess/failure, or simply provide nil if no further action is required.
Types ¶
type Channel ¶
Channel is used in opening/interacting with a single Slack channel
func (*Channel) ArchiveChannels ¶ added in v0.5.0
ArchiveChannels allows the user whose token was used to create the API client to archive multiple channels
func (*Channel) CreateChannel ¶
CreateChannel opens a new public channel and invites the provided list of member IDs, optionally posting an initial message
func (*Channel) InviteUsers ¶
func (*Channel) LeaveChannels ¶ added in v0.5.0
LeaveChannels allows the user whose token was used to create the API client to leave multiple channels