Documentation
¶
Index ¶
- Constants
- Variables
- func CreateEchoModal() slack.ModalViewRequest
- func CreateMenuModal() slack.ModalViewRequest
- func DelayedPing(s Slackingway) (slack.Msg, error)
- func Echo(s *SlackingwayWrapper) error
- func HomeTab(s *SlackingwayWrapper) error
- func Menu(s *SlackingwayWrapper) error
- func Ping() (slack.Msg, error)
- func ReceivedEcho(s *SlackingwayWrapper) (slack.Msg, error)
- func ReceivedMenu(s *SlackingwayWrapper) ([]slack.Block, error)
- func ValidateRequest(request events.APIGatewayProxyRequest, slackSigningSecret string) error
- func ValidateRole(role, userID string) bool
- type SlackAPIClient
- type SlackEvent
- type SlackRequestBody
- type Slackingway
- type SlackingwayWrapper
- func (s *SlackingwayWrapper) NewResponse(message slack.Msg) (*http.Request, error)
- func (s *SlackingwayWrapper) SendBlockMessage(blocks []slack.Block, channelID string) error
- func (s *SlackingwayWrapper) SendResponse(request *http.Request) error
- func (s *SlackingwayWrapper) SendTextMessage(message, channelID string) error
- func (s *SlackingwayWrapper) WriteToHistory(channelID string) error
Constants ¶
View Source
const ( SlackVersion = "v0" TimeAllowance = 30 * time.Second )
Variables ¶
View Source
var (
PingDelay = 5 * time.Second
)
Functions ¶
func CreateEchoModal ¶
func CreateEchoModal() slack.ModalViewRequest
func CreateMenuModal ¶
func CreateMenuModal() slack.ModalViewRequest
func DelayedPing ¶
func DelayedPing(s Slackingway) (slack.Msg, error)
DelayedPing sends a delayed ping response to the user
func Echo ¶
func Echo(s *SlackingwayWrapper) error
func HomeTab ¶
func HomeTab(s *SlackingwayWrapper) error
func Menu ¶
func Menu(s *SlackingwayWrapper) error
func ReceivedEcho ¶
func ReceivedEcho(s *SlackingwayWrapper) (slack.Msg, error)
func ReceivedMenu ¶
func ReceivedMenu(s *SlackingwayWrapper) ([]slack.Block, error)
func ValidateRequest ¶
func ValidateRequest(request events.APIGatewayProxyRequest, slackSigningSecret string) error
ValidateRequest verifies the request from Slack
func ValidateRole ¶
ValidateRole checks if the user ID is in the role
Types ¶
type SlackAPIClient ¶
type SlackAPIClient interface {
GetUserInfo(userID string) (*slack.User, error)
PostMessage(channelID string, options ...slack.MsgOption) (string, string, error)
OpenView(triggerID string, view slack.ModalViewRequest) (*slack.ViewResponse, error)
UpdateView(view slack.ModalViewRequest, externalID string, hash string, viewID string) (*slack.ViewResponse, error)
PublishView(userID string, view slack.HomeTabViewRequest, hash string) (*slack.ViewResponse, error)
}
type SlackEvent ¶
type SlackRequestBody ¶
type SlackRequestBody struct {
Timestamp string `json:"timestamp"`
Type string `json:"type"`
Challenge string `json:"challenge"`
Token string `json:"token"`
Command string `json:"command"`
Text string `json:"text"`
ResponseURL string `json:"response_url"`
UserID string `json:"user_id"`
ChannelID string `json:"channel_id"`
TeamID string `json:"team_id"`
CallbackID string `json:"callback_id"`
TriggerID string `json:"trigger_id"`
View slack.View `json:"view"`
Event SlackEvent `json:"event"`
}
Body of request data from Slack
func (*SlackRequestBody) ParsePayload ¶
func (s *SlackRequestBody) ParsePayload(payload string) error
ParsePayload parses the payload from Slack
func (*SlackRequestBody) ParseSlashCommand ¶
func (s *SlackRequestBody) ParseSlashCommand(requestData url.Values) error
ParseSlashCommand parses the slash command request from Slack
func (*SlackRequestBody) ParseTimestamp ¶
func (s *SlackRequestBody) ParseTimestamp(timestamp string) error
ParseTimestamp parses the timestamp from Slack
type Slackingway ¶
type SlackingwayWrapper ¶
type SlackingwayWrapper struct {
Debug bool
APIClient SlackAPIClient
HTTPClient *http.Client
SlackRequestBody *SlackRequestBody
}
func NewSlackingway ¶
func NewSlackingway(oauthToken string, s *SlackRequestBody) *SlackingwayWrapper
NewSlackingway creates a new SlackingwayWrapper
func (*SlackingwayWrapper) NewResponse ¶
NewResponse creates a new HTTP request for a Slack response
func (*SlackingwayWrapper) SendBlockMessage ¶
func (s *SlackingwayWrapper) SendBlockMessage(blocks []slack.Block, channelID string) error
SendBlockMessage sends a message with blocks to a Slack channel
func (*SlackingwayWrapper) SendResponse ¶
func (s *SlackingwayWrapper) SendResponse(request *http.Request) error
SendResponse sends a response to Slack
func (*SlackingwayWrapper) SendTextMessage ¶
func (s *SlackingwayWrapper) SendTextMessage(message, channelID string) error
SendTextMessage sends a message to a Slack channel
func (*SlackingwayWrapper) WriteToHistory ¶
func (s *SlackingwayWrapper) WriteToHistory(channelID string) error
WriteToHistory writes a message to Slackingway's history channel
Click to show internal directories.
Click to hide internal directories.