Documentation
¶
Index ¶
- type Canvas
- type CanvasService
- type Client
- type Conversation
- type ConversationsService
- func (s *ConversationsService) CreateConversation(ctx context.Context, name string, isPrivate bool) (*Conversation, error)
- func (s *ConversationsService) GetChannelByID(ctx context.Context, channelID string) (*Conversation, error)
- func (s *ConversationsService) GetConversationList(ctx context.Context, excludeArchived bool, channelTypes []string) ([]Conversation, error)
- func (s *ConversationsService) GetHistory(ctx context.Context, req *GetHistoryRequest) (*HistoryResponse, error)
- func (s *ConversationsService) GetReplies(ctx context.Context, req *GetRepliesRequest) (*HistoryResponse, error)
- func (s *ConversationsService) InviteUsersToChannel(ctx context.Context, userIDs []string, channelID string) (*Conversation, error)
- type EphemeralPostResult
- type Error
- type GetHistoryRequest
- type GetRepliesRequest
- type HistoryResponse
- type ListUserGroupUsersRequest
- type ListUsersRequest
- type ListUsersResponse
- type Message
- type MessagesService
- func (s *MessagesService) PostEphemeralMessage(ctx context.Context, req *PostEphemeralRequest) (*EphemeralPostResult, error)
- func (s *MessagesService) PostMessage(ctx context.Context, req *PostMessageRequest) (*PostedMessage, error)
- func (s *MessagesService) UpdateMessage(ctx context.Context, req *UpdateMessageRequest) (*PostedMessage, error)
- type ModalViewRequest
- type OpenViewResult
- type Option
- type PostEphemeralRequest
- type PostMessageRequest
- type PostedMessage
- type ResponseMetadata
- type SocketModeClient
- type SocketModeConn
- type SocketModeDialer
- type SocketModeEvent
- type SocketModeHandler
- type SocketModeHandlerFunc
- type SocketModeOption
- func WithAppLevelToken(appToken string) SocketModeOption
- func WithSocketModeBaseURL(baseURL string) SocketModeOption
- func WithSocketModeDialer(dialer SocketModeDialer) SocketModeOption
- func WithSocketModeLogger(logger transport.Logger) SocketModeOption
- func WithSocketModeReconnectDelay(delay time.Duration) SocketModeOption
- func WithSocketModeTransport(tr *transport.Client) SocketModeOption
- type SocketModeResponse
- type UpdateMessageRequest
- type UpdateUserGroupUsersRequest
- type User
- type UserGroup
- type UserGroupsService
- func (s *UserGroupsService) CreateUserGroup(ctx context.Context, name, tag string) (*UserGroup, error)
- func (s *UserGroupsService) ListUserGroupUsers(ctx context.Context, req *ListUserGroupUsersRequest) ([]string, error)
- func (s *UserGroupsService) ListUserGroups(ctx context.Context) ([]UserGroup, error)
- func (s *UserGroupsService) UpdateUserGroupUsers(ctx context.Context, req *UpdateUserGroupUsersRequest) (*UserGroup, error)
- type UserProfile
- type UsersService
- func (s *UsersService) GetUserByEmail(ctx context.Context, email string) (*User, error)
- func (s *UsersService) GetUserByID(ctx context.Context, userID string) (*User, error)
- func (s *UsersService) GetUsersByGroupID(ctx context.Context, userGroupID string) ([]User, error)
- func (s *UsersService) GetUsersByID(ctx context.Context, userIDs []string) ([]User, error)
- func (s *UsersService) ListUsers(ctx context.Context, req *ListUsersRequest) (*ListUsersResponse, error)
- type View
- type ViewText
- type ViewsService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CanvasService ¶
type CanvasService struct {
// contains filtered or unexported fields
}
CanvasService provides Slack canvas operations.
func (*CanvasService) CreateCanvas ¶
CreateCanvas creates a canvas with initial markdown content.
func (*CanvasService) ShareCanvas ¶
func (s *CanvasService) ShareCanvas(ctx context.Context, canvasID, channelID, accessLevel string) error
ShareCanvas shares canvas access with a channel.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is Slack Web API client.
func (*Client) Conversations ¶
func (c *Client) Conversations() *ConversationsService
Conversations returns conversations API service.
func (*Client) Messages ¶
func (c *Client) Messages() *MessagesService
Messages returns messages API service.
func (*Client) UserGroups ¶
func (c *Client) UserGroups() *UserGroupsService
UserGroups returns user groups API service.
type Conversation ¶
type Conversation struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
IsChannel bool `json:"is_channel,omitempty"`
IsGroup bool `json:"is_group,omitempty"`
IsPrivate bool `json:"is_private,omitempty"`
IsArchived bool `json:"is_archived,omitempty"`
NumMembers int `json:"num_members,omitempty"`
Creator string `json:"creator,omitempty"`
IsGeneral bool `json:"is_general,omitempty"`
ContextTeamID string `json:"context_team_id,omitempty"`
}
Conversation is a minimal Slack conversation DTO.
type ConversationsService ¶
type ConversationsService struct {
// contains filtered or unexported fields
}
ConversationsService provides Slack conversation operations.
func (*ConversationsService) CreateConversation ¶
func (s *ConversationsService) CreateConversation(ctx context.Context, name string, isPrivate bool) (*Conversation, error)
CreateConversation creates a Slack channel.
func (*ConversationsService) GetChannelByID ¶
func (s *ConversationsService) GetChannelByID(ctx context.Context, channelID string) (*Conversation, error)
GetChannelByID returns conversation by channel ID.
func (*ConversationsService) GetConversationList ¶
func (s *ConversationsService) GetConversationList(ctx context.Context, excludeArchived bool, channelTypes []string) ([]Conversation, error)
GetConversationList returns conversations and follows cursor pagination.
func (*ConversationsService) GetHistory ¶ added in v0.5.0
func (s *ConversationsService) GetHistory(ctx context.Context, req *GetHistoryRequest) (*HistoryResponse, error)
GetHistory fetches message history from a conversation. Uses conversations.history Slack API method.
func (*ConversationsService) GetReplies ¶ added in v0.5.0
func (s *ConversationsService) GetReplies(ctx context.Context, req *GetRepliesRequest) (*HistoryResponse, error)
GetReplies fetches replies (thread messages) for a given parent message. Uses conversations.replies Slack API method.
func (*ConversationsService) InviteUsersToChannel ¶
func (s *ConversationsService) InviteUsersToChannel(ctx context.Context, userIDs []string, channelID string) (*Conversation, error)
InviteUsersToChannel invites users to a channel.
type EphemeralPostResult ¶
type EphemeralPostResult struct {
Channel string `json:"channel,omitempty"`
MessageTS string `json:"message_ts,omitempty"`
}
EphemeralPostResult contains fields returned by chat.postEphemeral.
type GetHistoryRequest ¶ added in v0.5.0
type GetHistoryRequest struct {
Channel string `json:"channel"`
Cursor string `json:"cursor,omitempty"`
IncludeAllMetadata bool `json:"include_all_metadata,omitempty"`
Inclusive bool `json:"inclusive,omitempty"`
Latest string `json:"latest,omitempty"`
Oldest string `json:"oldest,omitempty"`
Limit int `json:"limit,omitempty"`
}
GetHistoryRequest contains parameters for conversations.history.
type GetRepliesRequest ¶ added in v0.5.0
type GetRepliesRequest struct {
Channel string `json:"channel"`
TS string `json:"ts"`
Cursor string `json:"cursor,omitempty"`
IncludeAllMetadata bool `json:"include_all_metadata,omitempty"`
Inclusive bool `json:"inclusive,omitempty"`
Latest string `json:"latest,omitempty"`
Oldest string `json:"oldest,omitempty"`
Limit int `json:"limit,omitempty"`
}
GetRepliesRequest contains parameters for conversations.replies.
type HistoryResponse ¶ added in v0.5.0
type HistoryResponse struct {
Messages []Message `json:"messages"`
HasMore bool `json:"has_more"`
PinCount int `json:"pin_count,omitempty"`
ResponseMetadata ResponseMetadata `json:"response_metadata"`
}
HistoryResponse is the response from conversations.history and conversations.replies.
type ListUserGroupUsersRequest ¶ added in v0.8.2
type ListUserGroupUsersRequest struct {
UserGroup string `json:"usergroup"`
IncludeDisabled bool `json:"include_disabled,omitempty"`
TeamID string `json:"team_id,omitempty"`
}
ListUserGroupUsersRequest contains parameters for usergroups.users.list.
type ListUsersRequest ¶ added in v0.8.2
type ListUsersRequest struct {
Cursor string `json:"cursor,omitempty"`
IncludeLocale bool `json:"include_locale,omitempty"`
Limit int `json:"limit,omitempty"`
TeamID string
FetchAll bool
// FetchAllThrottle defines pause between page requests when FetchAll=true.
// If <=0, a safe default of 1 second is used.
FetchAllThrottle time.Duration
}
ListUsersRequest contains parameters for users.list.
type ListUsersResponse ¶ added in v0.8.2
type ListUsersResponse struct {
Members []User `json:"members"`
CacheTS int64 `json:"cache_ts,omitempty"`
ResponseMetadata ResponseMetadata `json:"response_metadata"`
}
ListUsersResponse is the response from users.list.
type Message ¶
type Message struct {
Type string `json:"type,omitempty"`
SubType string `json:"subtype,omitempty"`
User string `json:"user,omitempty"`
Text string `json:"text,omitempty"`
TS string `json:"ts,omitempty"`
ThreadTS string `json:"thread_ts,omitempty"`
ReplyCount int `json:"reply_count,omitempty"`
}
Message is a minimal Slack message DTO.
type MessagesService ¶
type MessagesService struct {
// contains filtered or unexported fields
}
MessagesService provides Slack messaging operations.
func (*MessagesService) PostEphemeralMessage ¶
func (s *MessagesService) PostEphemeralMessage(ctx context.Context, req *PostEphemeralRequest) (*EphemeralPostResult, error)
PostEphemeralMessage posts an ephemeral message visible only to a specific user.
func (*MessagesService) PostMessage ¶
func (s *MessagesService) PostMessage(ctx context.Context, req *PostMessageRequest) (*PostedMessage, error)
PostMessage posts a message to a channel.
func (*MessagesService) UpdateMessage ¶
func (s *MessagesService) UpdateMessage(ctx context.Context, req *UpdateMessageRequest) (*PostedMessage, error)
UpdateMessage updates an existing message.
type ModalViewRequest ¶
type ModalViewRequest struct {
Type string `json:"type,omitempty"`
CallbackID string `json:"callback_id,omitempty"`
Title *ViewText `json:"title,omitempty"`
Close *ViewText `json:"close,omitempty"`
Submit *ViewText `json:"submit,omitempty"`
Blocks []map[string]any `json:"blocks,omitempty"`
PrivateMetadata string `json:"private_metadata,omitempty"`
ExternalID string `json:"external_id,omitempty"`
}
ModalViewRequest describes modal/home view payload for views.open/views.update.
type OpenViewResult ¶
type OpenViewResult struct {
View View `json:"view"`
}
OpenViewResult contains fields returned by views.open/views.update.
type Option ¶
type Option func(*config)
Option configures Slack client.
func WithBaseURL ¶
WithBaseURL overrides Slack API base URL.
func WithTeamID ¶
WithTeamID sets optional team_id for grid/org tokens.
func WithTransport ¶
WithTransport injects shared transport client.
type PostEphemeralRequest ¶ added in v0.4.0
type PostEphemeralRequest struct {
Channel string `json:"channel"`
User string `json:"user"`
Text string `json:"text,omitempty"`
Blocks []any `json:"blocks,omitempty"`
Attachments []any `json:"attachments,omitempty"`
ThreadTS string `json:"thread_ts,omitempty"`
}
PostEphemeralRequest is the payload for chat.postEphemeral.
type PostMessageRequest ¶ added in v0.4.0
type PostMessageRequest struct {
Channel string `json:"channel"`
Text string `json:"text,omitempty"`
Blocks []any `json:"blocks,omitempty"`
Attachments []any `json:"attachments,omitempty"`
ThreadTS string `json:"thread_ts,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
UnfurlLinks *bool `json:"unfurl_links,omitempty"`
UnfurlMedia *bool `json:"unfurl_media,omitempty"`
}
PostMessageRequest is the payload for chat.postMessage. Blocks and Attachments accept any JSON-serializable structs (e.g. slack-go block types, maps, or custom structs).
type PostedMessage ¶
type PostedMessage struct {
Channel string `json:"channel,omitempty"`
TS string `json:"ts,omitempty"`
Message Message `json:"message,omitempty"`
}
PostedMessage contains main fields returned by chat post/update methods.
type ResponseMetadata ¶
type ResponseMetadata struct {
NextCursor string `json:"next_cursor"`
}
ResponseMetadata is Slack cursor pagination metadata.
type SocketModeClient ¶
type SocketModeClient struct {
// contains filtered or unexported fields
}
SocketModeClient manages Slack socket mode lifecycle.
func NewSocketModeClient ¶
func NewSocketModeClient(opts ...SocketModeOption) *SocketModeClient
NewSocketModeClient creates a socket mode client.
func (*SocketModeClient) Run ¶
func (c *SocketModeClient) Run(ctx context.Context) error
Run starts socket mode processing loop.
func (*SocketModeClient) RunWithHandler ¶
func (c *SocketModeClient) RunWithHandler(ctx context.Context, handler SocketModeHandler) error
RunWithHandler starts socket mode loop and dispatches events to handler.
type SocketModeConn ¶
SocketModeConn abstracts websocket connection used by socket mode client.
type SocketModeDialer ¶
type SocketModeDialer interface {
Dial(ctx context.Context, wsURL string) (SocketModeConn, error)
}
SocketModeDialer opens websocket connection to provided URL.
type SocketModeEvent ¶
type SocketModeEvent struct {
Type string `json:"type,omitempty"`
EnvelopeID string `json:"envelope_id,omitempty"`
AcceptsResponsePayload bool `json:"accepts_response_payload,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
RetryAttempt int `json:"retry_attempt,omitempty"`
RetryReason string `json:"retry_reason,omitempty"`
Reason string `json:"reason,omitempty"`
}
SocketModeEvent is a single event envelope delivered over socket mode.
type SocketModeHandler ¶
type SocketModeHandler interface {
HandleEvent(ctx context.Context, event SocketModeEvent) (*SocketModeResponse, error)
}
SocketModeHandler processes socket mode events.
type SocketModeHandlerFunc ¶
type SocketModeHandlerFunc func(ctx context.Context, event SocketModeEvent) (*SocketModeResponse, error)
SocketModeHandlerFunc adapts function to SocketModeHandler.
func (SocketModeHandlerFunc) HandleEvent ¶
func (f SocketModeHandlerFunc) HandleEvent(ctx context.Context, event SocketModeEvent) (*SocketModeResponse, error)
HandleEvent calls f(ctx, event).
type SocketModeOption ¶
type SocketModeOption func(*socketModeConfig)
SocketModeOption configures SocketModeClient.
func WithAppLevelToken ¶
func WithAppLevelToken(appToken string) SocketModeOption
WithAppLevelToken sets app-level token for socket mode.
func WithSocketModeBaseURL ¶
func WithSocketModeBaseURL(baseURL string) SocketModeOption
WithSocketModeBaseURL overrides Slack API base URL for apps.connections.open.
func WithSocketModeDialer ¶
func WithSocketModeDialer(dialer SocketModeDialer) SocketModeOption
WithSocketModeDialer overrides websocket dialer implementation.
func WithSocketModeLogger ¶
func WithSocketModeLogger(logger transport.Logger) SocketModeOption
WithSocketModeLogger sets optional logger for socket mode runtime diagnostics.
func WithSocketModeReconnectDelay ¶
func WithSocketModeReconnectDelay(delay time.Duration) SocketModeOption
WithSocketModeReconnectDelay sets reconnect delay after connection errors.
func WithSocketModeTransport ¶
func WithSocketModeTransport(tr *transport.Client) SocketModeOption
WithSocketModeTransport injects transport used by apps.connections.open calls.
type SocketModeResponse ¶
type SocketModeResponse struct {
Payload any `json:"payload,omitempty"`
}
SocketModeResponse contains optional payload sent in envelope ACK.
type UpdateMessageRequest ¶ added in v0.4.0
type UpdateMessageRequest struct {
Channel string `json:"channel"`
TS string `json:"ts"`
Text string `json:"text,omitempty"`
Blocks []any `json:"blocks,omitempty"`
Attachments []any `json:"attachments,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
UpdateMessageRequest is the payload for chat.update.
type UpdateUserGroupUsersRequest ¶ added in v0.8.2
type UpdateUserGroupUsersRequest struct {
UserGroup string `json:"usergroup"`
Users []string `json:"users"`
IncludeCount bool `json:"include_count,omitempty"`
TeamID string `json:"team_id,omitempty"`
AdditionalChannels []string `json:"additional_channels,omitempty"`
}
UpdateUserGroupUsersRequest contains parameters for usergroups.users.update.
type User ¶
type User struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
IsBot bool `json:"is_bot,omitempty"`
Updated int64 `json:"updated,omitempty"`
IsAppUser bool `json:"is_app_user,omitempty"`
TeamID string `json:"team_id,omitempty"`
Deleted bool `json:"deleted,omitempty"`
Color string `json:"color,omitempty"`
IsEmailConfirmed bool `json:"is_email_confirmed,omitempty"`
RealName string `json:"real_name,omitempty"`
TZ string `json:"tz,omitempty"`
TZLabel string `json:"tz_label,omitempty"`
TZOffset int `json:"tz_offset,omitempty"`
IsAdmin bool `json:"is_admin,omitempty"`
IsOwner bool `json:"is_owner,omitempty"`
IsPrimaryOwner bool `json:"is_primary_owner,omitempty"`
IsRestricted bool `json:"is_restricted,omitempty"`
IsUltraRestricted bool `json:"is_ultra_restricted,omitempty"`
Profile UserProfile `json:"profile,omitempty"`
}
User is Slack user DTO.
type UserGroup ¶
type UserGroup struct {
ID string `json:"id"`
TeamID string `json:"team_id,omitempty"`
Name string `json:"name,omitempty"`
Handle string `json:"handle,omitempty"`
Description string `json:"description,omitempty"`
}
UserGroup is a minimal Slack user group DTO.
type UserGroupsService ¶
type UserGroupsService struct {
// contains filtered or unexported fields
}
UserGroupsService provides Slack user groups operations.
func (*UserGroupsService) CreateUserGroup ¶
func (s *UserGroupsService) CreateUserGroup(ctx context.Context, name, tag string) (*UserGroup, error)
CreateUserGroup creates a user group in Slack.
func (*UserGroupsService) ListUserGroupUsers ¶ added in v0.8.2
func (s *UserGroupsService) ListUserGroupUsers(ctx context.Context, req *ListUserGroupUsersRequest) ([]string, error)
ListUserGroupUsers lists members of a user group using usergroups.users.list.
func (*UserGroupsService) ListUserGroups ¶
func (s *UserGroupsService) ListUserGroups(ctx context.Context) ([]UserGroup, error)
ListUserGroups lists user groups.
func (*UserGroupsService) UpdateUserGroupUsers ¶ added in v0.8.2
func (s *UserGroupsService) UpdateUserGroupUsers(ctx context.Context, req *UpdateUserGroupUsersRequest) (*UserGroup, error)
UpdateUserGroupUsers updates members of a user group using usergroups.users.update.
type UserProfile ¶ added in v0.8.2
type UserProfile struct {
RealName string `json:"real_name,omitempty"`
DisplayName string `json:"display_name,omitempty"`
AvatarHash string `json:"avatar_hash,omitempty"`
RealNameNormalized string `json:"real_name_normalized,omitempty"`
DisplayNameNormalized string `json:"display_name_normalized,omitempty"`
Image24 string `json:"image_24,omitempty"`
Image32 string `json:"image_32,omitempty"`
Image48 string `json:"image_48,omitempty"`
Image72 string `json:"image_72,omitempty"`
Image192 string `json:"image_192,omitempty"`
Image512 string `json:"image_512,omitempty"`
Image1024 string `json:"image_1024,omitempty"`
ImageOriginal string `json:"image_original,omitempty"`
IsCustomImage bool `json:"is_custom_image,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Team string `json:"team,omitempty"`
Email string `json:"email,omitempty"`
Title string `json:"title,omitempty"`
Phone string `json:"phone,omitempty"`
Skype string `json:"skype,omitempty"`
StatusText string `json:"status_text,omitempty"`
StatusTextCanonical string `json:"status_text_canonical,omitempty"`
StatusEmoji string `json:"status_emoji,omitempty"`
StatusEmojiDisplayInfo []any `json:"status_emoji_display_info,omitempty"`
StatusExpiration int `json:"status_expiration,omitempty"`
BotID string `json:"bot_id,omitempty"`
APIAppID string `json:"api_app_id,omitempty"`
AlwaysActive bool `json:"always_active,omitempty"`
}
UserProfile is Slack user profile payload.
type UsersService ¶
type UsersService struct {
// contains filtered or unexported fields
}
UsersService provides Slack users operations.
func (*UsersService) GetUserByEmail ¶
GetUserByEmail returns user by email.
func (*UsersService) GetUserByID ¶
GetUserByID returns user by ID.
func (*UsersService) GetUsersByGroupID ¶
GetUsersByGroupID returns users belonging to a user group.
func (*UsersService) GetUsersByID ¶
GetUsersByID returns users for provided IDs.
func (*UsersService) ListUsers ¶ added in v0.8.2
func (s *UsersService) ListUsers(ctx context.Context, req *ListUsersRequest) (*ListUsersResponse, error)
ListUsers returns users from users.list and optionally fetches all pages.
type View ¶
type View struct {
ID string `json:"id,omitempty"`
ExternalID string `json:"external_id,omitempty"`
Type string `json:"type,omitempty"`
CallbackID string `json:"callback_id,omitempty"`
Hash string `json:"hash,omitempty"`
}
View is a minimal Slack view response DTO.
type ViewText ¶
type ViewText struct {
Type string `json:"type"`
Text string `json:"text"`
Emoji bool `json:"emoji,omitempty"`
}
ViewText represents Slack plain_text/markdown text object.
type ViewsService ¶
type ViewsService struct {
// contains filtered or unexported fields
}
ViewsService provides Slack modal/home views operations.
func (*ViewsService) OpenView ¶
func (s *ViewsService) OpenView(ctx context.Context, triggerID string, req *ModalViewRequest) (*OpenViewResult, error)
OpenView opens a view for the provided trigger.
func (*ViewsService) UpdateView ¶
func (s *ViewsService) UpdateView(ctx context.Context, view ModalViewRequest, externalID, hash, viewID string) (*OpenViewResult, error)
UpdateView updates an existing view by viewID or externalID.