Documentation
¶
Index ¶
- Variables
- func AddBookmarkActivity(ctx workflow.Context, cmd *cli.Command, channelID, title, url string)
- func AddReactionActivity(ctx workflow.Context, cmd *cli.Command, channelID, timestamp, emoji string) error
- func ArchiveChannelActivity(ctx workflow.Context, cmd *cli.Command, channelID string) error
- func CreateChannelActivity(ctx workflow.Context, cmd *cli.Command, name, url string) (string, bool, error)
- func DeleteChatMessageActivity(ctx workflow.Context, cmd *cli.Command, channelID, timestamp string) error
- func InviteUsersToChannelActivity(ctx workflow.Context, cmd *cli.Command, channelID string, userIDs []string) error
- func KickUserFromChannelActivity(ctx workflow.Context, cmd *cli.Command, channelID, userID string) error
- func NormalizeChannelName(name string, maxLen int) string
- func RegisterSignals(ctx workflow.Context, sel workflow.Selector, taskQueue string)
- func RegisterWorkflows(w worker.Worker, cmd *cli.Command)
- func RemoveReactionActivity(ctx workflow.Context, cmd *cli.Command, channelID, timestamp, emoji string) error
- func SetChannelDescriptionActivity(ctx workflow.Context, cmd *cli.Command, channelID, title, url string)
- func SetChannelTopicActivity(ctx workflow.Context, cmd *cli.Command, channelID, url string)
- func UpdateChatMessageActivity(ctx workflow.Context, cmd *cli.Command, req ChatUpdateRequest) error
- type Channel
- type ChatPostMessageRequest
- type ChatPostMessageResponse
- type ChatUpdateRequest
- type Config
- type ConversationsCreateResponse
- type MemberEvent
- type MessageEvent
- type Profile
- type ReactionEvent
- type SlashCommandEvent
- type User
Constants ¶
This section is empty.
Variables ¶
var Signals = []string{
"slack.events.app_rate_limited",
"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 AddBookmarkActivity ¶
func AddReactionActivity ¶ added in v0.3.0
func CreateChannelActivity ¶
func CreateChannelActivity(ctx workflow.Context, cmd *cli.Command, name, url string) (string, bool, error)
https://docs.slack.dev/reference/methods/conversations.create
func DeleteChatMessageActivity ¶ added in v0.3.0
func InviteUsersToChannelActivity ¶
func InviteUsersToChannelActivity(ctx workflow.Context, cmd *cli.Command, channelID string, userIDs []string) error
https://docs.slack.dev/reference/methods/conversations.invite
func KickUserFromChannelActivity ¶ added in v0.2.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 RegisterSignals ¶ added in v0.3.0
RegisterSignals routes Signals to registered workflows.
func RegisterWorkflows ¶ added in v0.3.0
RegisterWorkflows maps event handler functions to Signals.
func RemoveReactionActivity ¶ added in v0.3.0
func SetChannelDescriptionActivity ¶
func SetChannelDescriptionActivity(ctx workflow.Context, cmd *cli.Command, channelID, title, url string)
https://docs.slack.dev/reference/methods/conversations.setPurpose
func UpdateChatMessageActivity ¶ added in v0.3.0
Types ¶
type ChatPostMessageRequest ¶
type ChatPostMessageRequest struct {
Channel string `json:"channel"`
Blocks []map[string]any `json:"blocks,omitempty"`
Attachments []map[string]any `json:"attachments,omitempty"`
MarkdownText string `json:"markdown_text,omitempty"`
Text string `json:"text,omitempty"`
ThreadTS string `json:"thread_ts,omitempty"`
ReplyBroadcast bool `json:"reply_broadcast,omitempty"`
IconEmoji string `json:"icon_emoji,omitempty"`
IconURL string `json:"icon_url,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
LinkNames bool `json:"link_names,omitempty"`
// Ignoring "mrkdwn" for now, because it has an unusual default value (true).
Parse string `json:"parse,omitempty"`
UnfurlLinks bool `json:"unfurl_links,omitempty"`
UnfurlMedia bool `json:"unfurl_media,omitempty"`
Username string `json:"username,omitempty"`
}
type ChatPostMessageResponse ¶
type ChatPostMessageResponse struct {
Channel string `json:"channel,omitempty"`
TS string `json:"ts,omitempty"`
Message map[string]any `json:"message,omitempty"`
// contains filtered or unexported fields
}
https://docs.slack.dev/reference/methods/chat.postMessage
func PostChatMessageActivity ¶
func PostChatMessageActivity(ctx workflow.Context, cmd *cli.Command, req ChatPostMessageRequest) (*ChatPostMessageResponse, error)
type ChatUpdateRequest ¶ added in v0.2.0
type ChatUpdateRequest struct {
Channel string `json:"channel"`
TS string `json:"ts"`
Blocks []map[string]any `json:"blocks,omitempty"`
Attachments []map[string]any `json:"attachments,omitempty"`
MarkdownText string `json:"markdown_text,omitempty"`
Text string `json:"text,omitempty"`
AsUser bool `json:"as_user,omitempty"`
FileIDs []string `json:"file_ids,omitempty"`
LinkNames bool `json:"link_names,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Parse string `json:"parse,omitempty"`
ReplyBroadcast bool `json:"reply_broadcast,omitempty"`
}
https://docs.slack.dev/reference/methods/chat.update
https://docs.slack.dev/reference/methods/chat.postMessage#channels
type ConversationsCreateResponse ¶
type ConversationsCreateResponse struct {
Channel *Channel `json:"channel,omitempty"`
// contains filtered or unexported fields
}
https://docs.slack.dev/reference/methods/conversations.create
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"`
Hidden bool `json:"hidden,omitempty"` // For example, when subtype = "message_changed" or "message_deleted".
Team string `json:"team,omitempty"`
Channel string `json:"channel"`
ChannelType string `json:"channel_type"`
User string `json:"user"`
Text string `json:"text"`
Edited *edited `json:"edited"` // 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".
DeletedTS string `json:"deleted_ts,omitempty"` // Subtype = "message_deleted".
ThreadTS string `json:"thread_ts,omitempty"` // Reply, or subtype = "thread_broadcast".
ParentUserID string `json:"parent_user_id,omitempty"` // Subtype = "thread_broadcast".
ClientMsgID string `json:"client_msg_id,omitempty"`
EventTS string `json:"event_ts"`
TS string `json:"ts"`
}
type Profile ¶ added in v0.2.0
type Profile struct {
DisplayName string `json:"display_name"`
DisplayNameNormalized string `json:"display_name_normalized"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
RealName string `json:"real_name"`
RealNameNormalized string `json:"real_name_normalized"`
Email string `json:"email"`
Team string `json:"team"`
Image24 string `json:"image_24"`
Image32 string `json:"image_32"`
Image48 string `json:"image_48"`
Image72 string `json:"image_72"`
Image192 string `json:"image_192"`
Image512 string `json:"image_512"`
APIAppID string `json:"api_app_id,omitempty"`
BotID string `json:"bot_id,omitempty"`
AlwaysActive bool `json:"always_active,omitempty"`
}
https://docs.slack.dev/reference/objects/user-object/#profile
func UserProfileActivity ¶ added in v0.2.0
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
type User ¶ added in v0.2.0
type User struct {
ID string `json:"id"`
TeamID string `json:"team_id"`
RealName string `json:"real_name"`
IsBot bool `json:"is_bot"`
TZ string `json:"tz"`
TZLabel string `json:"tz_label"`
TZOffset int `json:"tz_offset"`
Updated int `json:"updated"`
Profile Profile `json:"profile"`
}
https://docs.slack.dev/reference/objects/user-object/. A slimmer version can be found in "pkg/users/slack.go".