Documentation
¶
Index ¶
- Constants
- Variables
- func AppRateLimitedWorkflow(ctx workflow.Context, event map[string]any) error
- func ChannelArchivedWorkflow(ctx workflow.Context, event archiveEventWrapper) error
- func CreateSchedule(ctx context.Context, c client.Client, cmd *cli.Command)
- func DrainSignals(ctx workflow.Context, taskQueue string) bool
- func MemberJoinedWorkflow(ctx workflow.Context, event memberEventWrapper) error
- func MemberLeftWorkflow(ctx workflow.Context, event memberEventWrapper) error
- func ReactionAddedWorkflow(ctx workflow.Context, event reactionEventWrapper) error
- func ReactionRemovedWorkflow(ctx workflow.Context, event reactionEventWrapper) error
- func RegisterSignals(ctx workflow.Context, sel workflow.Selector, taskQueue string)
- func RegisterWorkflows(ctx context.Context, cmd *cli.Command, w worker.Worker)
- func RemindersWorkflow(ctx workflow.Context) error
- type ArchiveEvent
- type Config
- func (c *Config) MessageWorkflow(ctx workflow.Context, event messageEventWrapper) error
- func (c *Config) OptInSlashCommand(ctx workflow.Context, event commands.SlashCommandEvent) error
- func (c *Config) OptOutSlashCommand(ctx workflow.Context, event commands.SlashCommandEvent) error
- func (c *Config) SlashCommandWorkflow(ctx workflow.Context, event commands.SlashCommandEvent) error
- type Edited
- type File
- type MemberEvent
- type MessageEvent
- type Reaction
- type ReactionEvent
Constants ¶
const (
DefaultReminderTime = "8:00AM"
)
Variables ¶
var Schedules = []string{
"slack.schedules.reminders",
}
Schedules is a list of workflow names that RevChat runs periodically via Temporal schedules (https://docs.temporal.io/develop/go/schedules).
var Signals = []string{
"slack.events.app_rate_limited",
"slack.events.channel_archive",
"slack.events.group_archive",
"slack.events.member_joined_channel",
"slack.events.member_left_channel",
"slack.events.message",
"slack.events.reaction_added",
"slack.events.reaction_removed",
"slack.events.slash_command",
}
Signals is a list of signal names that RevChat receives from Timpani, to trigger event handling workflows.
This is based on:
Functions ¶
func AppRateLimitedWorkflow ¶
AppRateLimitedWorkflow highlights Slack rate-limiting events:
func ChannelArchivedWorkflow ¶
ChannelArchivedWorkflow handles PR data cleanups after unexpected Slack archiving events, so RevChat will not try to modify or post messages to archived channels:
func CreateSchedule ¶
CreateSchedule starts a scheduled workflow that runs every 30 minutes, to send daily reminders.
func DrainSignals ¶
DrainSignals drains all pending Signals channels, and waits for their corresponding workflow executions to complete in order. This is called in preparation for resetting the dispatcher workflow's history.
func MemberJoinedWorkflow ¶
MemberJoinedWorkflow ensures that users who are added to RevChat channels by others are opted-in: https://docs.slack.dev/reference/events/member_joined_channel/
func MemberLeftWorkflow ¶
MemberLeftWorkflow is (or rather will be) based on: https://docs.slack.dev/reference/events/member_left_channel/
func ReactionAddedWorkflow ¶
ReactionAddedWorkflow mirrors the addition of a reaction to a Slack message in the corresponding PR comment: https://docs.slack.dev/reference/events/reaction_added/
func ReactionRemovedWorkflow ¶
ReactionRemovedWorkflow mirrors the removal of a reaction from a Slack message in the corresponding PR comment: https://docs.slack.dev/reference/events/reaction_removed/
func RegisterSignals ¶
RegisterSignals routes Signals to their registered workflows.
func RegisterWorkflows ¶
RegisterWorkflows maps event-handling workflow functions to Signals.
func RemindersWorkflow ¶
Types ¶
type ArchiveEvent ¶
type ArchiveEvent struct {
Channel string `json:"channel"`
User string `json:"user"`
IsMoved int `json:"is_moved,omitempty"`
EventTS string `json:"event_ts"`
}
https://docs.slack.dev/reference/events/channel_archive/ https://docs.slack.dev/reference/events/channel_unarchive/ https://docs.slack.dev/reference/events/group_archive/ https://docs.slack.dev/reference/events/group_unarchive/
type Config ¶
type Config struct {
BitbucketWorkspace string
ThrippyGRPCAddress string
ThrippyHTTPAddress string
ThrippyLinksTemplate string
// contains filtered or unexported fields
}
func (*Config) MessageWorkflow ¶
MessageWorkflow mirrors Slack message creation/editing/deletion events as/in PR comments: https://docs.slack.dev/reference/events/message/
func (*Config) OptInSlashCommand ¶
func (*Config) OptOutSlashCommand ¶
func (*Config) SlashCommandWorkflow ¶
SlashCommandWorkflow routes user command events to their respective handlers in the commands package:
type File ¶
type File struct {
ID string `json:"id"`
Name string `json:"name"`
Title string `json:"title"`
MimeType string `json:"mimetype"`
FileType string `json:"filetype"` // https://docs.slack.dev/reference/objects/file-object#types
PrettyType string `json:"pretty_type"`
Size int `json:"size"`
OriginalW int `json:"original_w"`
OriginalH int `json:"original_h"`
Mode string `json:"mode"` // One of: "hosted", "external", "snippet", or "post".
Editable bool `json:"editable"`
IsExternal bool `json:"is_external"`
IsPublic bool `json:"is_public"`
ExternalType string `json:"external_type"`
MediaDisplayType string `json:"media_display_type"`
Username string `json:"username"`
DisplayAsBot bool `json:"display_as_bot"`
URLPrivate string `json:"url_private"`
URLPrivateDownload string `json:"url_private_download"`
Permalink string `json:"permalink"`
PermalinkPublic string `json:"permalink_public"`
EditLink string `json:"edit_link,omitempty"`
Thumb64 string `json:"thumb_64,omitempty"`
Thumb80 string `json:"thumb_80,omitempty"`
Thumb160 string `json:"thumb_160,omitempty"`
Thumb360 string `json:"thumb_360,omitempty"`
Thumb360Gif string `json:"thumb_360_gif,omitempty"`
Thumb480 string `json:"thumb_480,omitempty"`
Thumb720 string `json:"thumb_720,omitempty"`
Thumb800 string `json:"thumb_800,omitempty"`
Thumb960 string `json:"thumb_960,omitempty"`
Thumb1024 string `json:"thumb_1024,omitempty"`
ThumbTiny string `json:"thumb_tiny,omitempty"`
Preview string `json:"preview,omitempty"`
PreviewHighlight string `json:"preview_highlight,omitempty"`
PreviewIsTruncated bool `json:"preview_is_truncated,omitempty"`
Lines int `json:"lines,omitempty"`
LinesMore int `json:"lines_more,omitempty"`
HasRichPreview bool `json:"has_rich_preview,omitempty"`
FileAccess string `json:"file_access,omitempty"`
}
https://docs.slack.dev/reference/events/message/file_share https://docs.slack.dev/reference/objects/file-object
type MemberEvent ¶
type MemberEvent struct {
Enterprise string `json:"enterprise,omitempty"`
Team string `json:"team"`
Channel string `json:"channel"`
ChannelType string `json:"channel_type"`
User string `json:"user"`
Inviter string `json:"inviter,omitempty"`
}
https://docs.slack.dev/reference/events/member_joined_channel/ https://docs.slack.dev/reference/events/member_left_channel/
type MessageEvent ¶
type MessageEvent struct {
Subtype string `json:"subtype,omitempty"`
User string `json:"user,omitempty"`
BotID string `json:"bot_id,omitempty"`
Username string `json:"username,omitempty"` // Customized display name, when bot_id is present.
Team string `json:"team,omitempty"`
SourceTeam string `json:"source_team,omitempty"`
UserTeam string `json:"user_team,omitempty"`
Channel string `json:"channel,omitempty"`
ChannelType string `json:"channel_type,omitempty"`
Text string `json:"text,omitempty"`
Blocks []map[string]any `json:"blocks,omitempty"`
Edited *Edited `json:"edited,omitempty"` // Subtype = "message_changed".
Message *MessageEvent `json:"message,omitempty"` // Subtype = "message_changed".
PreviousMessage *MessageEvent `json:"previous_message,omitempty"` // Subtype = "message_changed" or "message_deleted".
Root *MessageEvent `json:"root,omitempty"` // Subtype = "thread_broadcast".
TS string `json:"ts"`
EventTS string `json:"event_ts,omitempty"`
DeletedTS string `json:"deleted_ts,omitempty"` // Subtype = "message_deleted".
ThreadTS string `json:"thread_ts,omitempty"` // Reply, or subtype = "thread_broadcast".
LatestReply string `json:"latest_reply,omitempty"`
ReplyCount int `json:"reply_count,omitempty"`
ReplyUsers []string `json:"reply_users,omitempty"`
ReplyUsersCount int `json:"reply_users_count,omitempty"`
// https://docs.slack.dev/reference/events/message/file_share
Files []File `json:"files,omitempty"`
Upload bool `json:"upload,omitempty"`
DisplayAsBot bool `json:"display_as_bot,omitempty"`
// https://docs.slack.dev/reference/events/message/#stars
IsStarred bool `json:"is_starred,omitempty"`
PinnedTo []string `json:"pinned_to,omitempty"`
Reactions []Reaction `json:"reactions,omitempty"`
}
type Reaction ¶
type ReactionEvent ¶
type ReactionEvent struct {
User string `json:"user"`
Reaction string `json:"reaction"`
Item struct {
Type string `json:"type"`
Channel string `json:"channel,omitempty"`
TS string `json:"ts,omitempty"`
File string `json:"file,omitempty"`
FileComment string `json:"file_comment,omitempty"`
} `json:"item"`
ItemUser string `json:"item_user,omitempty"`
EventTS string `json:"event_ts"`
}
https://docs.slack.dev/reference/events/reaction_added/ https://docs.slack.dev/reference/events/reaction_removed/