Documentation ¶
Overview ¶
Package slack supports invoking the randomizer as a Slack slash command.
Index ¶
Constants ¶
const DefaultAWSParameterTTL = 2 * time.Minute
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { // TokenProvider provides the expected value of the slash command verification // token generated by Slack. This can be obtained from the slash command // configuration. TokenProvider TokenProvider // StoreFactory provides a Store for the Slack channel in which the request // was made. StoreFactory store.Factory // Logger, if non-nil, will be used to report information about errors that // occur while handling each request. Logger *slog.Logger }
App provides HTTP handling logic that allows the randomizer to be integrated as a slash command in a Slack workspace.
Note that App currently only supports static verification tokens to check that a request legitimately originated from Slack, and does not support the newer signed secrets functionality.
type TokenProvider ¶
TokenProvider provides the value of the slash command verification token generated by Slack.
func AWSParameter ¶
func AWSParameter(name string, ttl time.Duration) TokenProvider
AWSParameter retrieves the expected value of the verification token from the AWS SSM Parameter Store, decrypting it if necessary, and caches the retrieved token value for the provided TTL.
func StaticToken ¶
func StaticToken(token string) TokenProvider
StaticToken uses token as the expected value of the verification token.
func TokenProviderFromEnv ¶
func TokenProviderFromEnv() (TokenProvider, error)
TokenProviderFromEnv returns a TokenProvider based on available environment variables.
If SLACK_TOKEN is set, it will return a static token provider.
If SLACK_TOKEN_SSM_NAME is set, it will return an AWS SSM token provider, with the TTL optionally set by SLACK_TOKEN_SSM_TTL.
Otherwise, it will return an error.