Documentation
¶
Index ¶
- Constants
- Variables
- func CreateChannel(ctx workflow.Context, name, url string, private bool) (string, bool, error)
- func CreateSchedule(ctx context.Context, c client.Client, cmd *cli.Command)
- func DeleteMessage(ctx workflow.Context, channelID, timestamp string) error
- func DrainSignals(ctx workflow.Context, taskQueue string) bool
- func InviteUsersToChannel(ctx workflow.Context, channelID string, userIDs []string) error
- func KickUsersFromChannel(ctx workflow.Context, channelID string, userIDs []string) error
- func NormalizeChannelName(name string, maxLen int) string
- func PostEphemeralMessage(ctx workflow.Context, channelID, userID, msg string) error
- func PostMessage(ctx workflow.Context, channelID, msg string) (*slack.ChatPostMessageResponse, error)
- func PostMessageAsUser(ctx workflow.Context, channelID, name, icon, msg string) (*slack.ChatPostMessageResponse, error)
- func PostReply(ctx workflow.Context, channelID, timestamp, msg string) (*slack.ChatPostMessageResponse, error)
- func PostReplyAsUser(ctx workflow.Context, channelID, timestamp, name, icon, msg string) (*slack.ChatPostMessageResponse, error)
- func RegisterSignals(ctx workflow.Context, sel workflow.Selector, taskQueue string)
- func RegisterWorkflows(ctx context.Context, w worker.Worker, cmd *cli.Command)
- func RenameChannel(ctx workflow.Context, channelID, name string) (bool, error)
- func SetChannelDescription(ctx workflow.Context, channelID, title, url string)
- func SetChannelTopic(ctx workflow.Context, channelID, url string)
- func UpdateMessage(ctx workflow.Context, channelID, timestamp, msg string) error
- type ArchiveEvent
- type Config
- type Edited
- type MemberEvent
- type MessageEvent
- type ReactionEvent
- type SlashCommandEvent
Constants ¶
const (
DefaultReminderTime = "8:00AM"
)
const (
ErrLinkAuthzTimeout = "link not authorized yet" // For some reason errors.Is() doesn't work across Temporal.
)
const ExpectedSubmatches = 6
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 CreateChannel ¶ added in v0.4.0
func CreateSchedule ¶ added in v0.5.0
CreateSchedule starts a scheduled workflow that runs every 30 minutes.
func DeleteMessage ¶ added in v0.4.0
func DrainSignals ¶ added in v0.7.0
DrainSignals drains all pending Signals channels, starts their corresponding workflows as usual, and returns true if any signals were found. This is called in preparation for resetting the dispatcher workflow's history.
func InviteUsersToChannel ¶ added in v0.4.0
func KickUsersFromChannel ¶ added in v0.5.0
func NormalizeChannelName ¶
NormalizeChannelName transforms arbitrary text into a valid Slack channel name. Based on: https://docs.slack.dev/reference/methods/conversations.create#naming.
func PostEphemeralMessage ¶ added in v0.4.0
func PostMessage ¶ added in v0.4.0
func PostMessageAsUser ¶ added in v0.4.0
func PostReplyAsUser ¶ added in v0.4.0
func RegisterSignals ¶ added in v0.3.0
RegisterSignals routes Signals to their registered workflows.
func RegisterWorkflows ¶ added in v0.3.0
RegisterWorkflows maps event-handling workflow functions to Signals.
func RenameChannel ¶ added in v0.5.0
func SetChannelDescription ¶ added in v0.4.0
func SetChannelTopic ¶ added in v0.4.0
Types ¶
type ArchiveEvent ¶ added in v0.7.0
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 MemberEvent ¶ added in v0.3.0
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 ¶ added in v0.3.0
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"`
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".
ReplyCount int `json:"reply_count,omitempty"`
ReplyUsers []string `json:"reply_users,omitempty"`
ReplyUsersCount int `json:"reply_users_count,omitempty"`
LatestReply string `json:"latest_reply,omitempty"`
Hidden bool `json:"hidden,omitempty"`
IsLocked bool `json:"is_locked,omitempty"`
Subscribed bool `json:"subscribed,omitempty"`
LastRead string `json:"last_read,omitempty"`
}
type ReactionEvent ¶ added in v0.3.0
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/
type SlashCommandEvent ¶ added in v0.3.0
type SlashCommandEvent struct {
APIAppID string `json:"api_app_id"`
IsEnterpriseInstall string `json:"is_enterprise_install"`
EnterpriseID string `json:"enterprise_id,omitempty"`
EnterpriseName string `json:"enterprise_name,omitempty"`
TeamID string `json:"team_id"`
TeamDomain string `json:"team_domain"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
UserID string `json:"user_id"`
UserName string `json:"user_name"`
Command string `json:"command"`
Text string `json:"text"`
ResponseURL string `json:"response_url"`
TriggerID string `json:"trigger_id"`
}
https://docs.slack.dev/interactivity/implementing-slash-commands/#app_command_handling https://docs.slack.dev/apis/events-api/using-socket-mode#command