slack

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 AddBookmarkActivity(ctx workflow.Context, cmd *cli.Command, channelID, title, url string)

https://docs.slack.dev/reference/methods/bookmarks.add

func AddReactionActivity added in v0.3.0

func AddReactionActivity(ctx workflow.Context, cmd *cli.Command, channelID, timestamp, emoji string) error

https://docs.slack.dev/reference/methods/reactions.add

func DeleteChatMessageActivity added in v0.3.0

func DeleteChatMessageActivity(ctx workflow.Context, cmd *cli.Command, channelID, timestamp string) error

https://docs.slack.dev/reference/methods/chat.delete

func KickUserFromChannelActivity added in v0.2.0

func KickUserFromChannelActivity(ctx workflow.Context, cmd *cli.Command, channelID, userID string) error

https://docs.slack.dev/reference/methods/conversations.kick

func NormalizeChannelName

func NormalizeChannelName(name string, maxLen int) string

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

func RegisterSignals(ctx workflow.Context, sel workflow.Selector, taskQueue string)

RegisterSignals routes Signals to registered workflows.

func RegisterWorkflows added in v0.3.0

func RegisterWorkflows(w worker.Worker, cmd *cli.Command)

RegisterWorkflows maps event handler functions to Signals.

func RemoveReactionActivity added in v0.3.0

func RemoveReactionActivity(ctx workflow.Context, cmd *cli.Command, channelID, timestamp, emoji string) error

https://docs.slack.dev/reference/methods/reactions.remove

Types

type Channel added in v0.2.0

type Channel struct {
	ID string `json:"id"`
}

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"`
}

https://docs.slack.dev/reference/methods/chat.postMessage

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

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 Config added in v0.3.0

type Config struct {
	Cmd *cli.Command
}

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"`
}

https://docs.slack.dev/reference/events/message/

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

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".

func UserInfoActivity added in v0.2.0

func UserInfoActivity(ctx workflow.Context, cmd *cli.Command, userID string) (*User, error)

https://docs.slack.dev/reference/methods/users.info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL