Documentation ¶
Overview ¶
Package conversations is a lightweight wrapper over the "conversations" methods in Slack's Web API: https://api.slack.com/methods?filter=conversations.
Index ¶
- type API
- func (a API) Archive(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) Close(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) Create(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) History(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) Info(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) Invite(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) List(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) Members(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) Open(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) Rename(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) Replies(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) SetPurpose(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) SetTopic(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- func (a API) Unarchive(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
- type ArchiveRequest
- type ArchiveResponse
- type Channel
- type CloseRequest
- type CloseResponse
- type CreateRequest
- type CreateResponse
- type Error
- type HistoryRequest
- type HistoryResponse
- type InfoResponse
- type InviteRequest
- type InviteResponse
- type ListResponse
- type MembersResponse
- type OpenRequest
- type OpenResponse
- type Purpose
- type RenameRequest
- type RenameResponse
- type RepliesResponse
- type SetPurposeRequest
- type SetPurposeResponse
- type SetTopicRequest
- type SetTopicResponse
- type Topic
- type UnarchiveRequest
- type UnarchiveResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Secrets sdkservices.Secrets Scope string }
func (API) Archive ¶
func (a API) Archive(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
Archive a conversation (channel).
Based on: https://api.slack.com/methods/conversations.archive
Required Slack app scopes:
func (API) Close ¶
func (a API) Close(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
Close a direct message or multi-person direct message.
Based on: https://api.slack.com/methods/conversations.close
Required Slack app scopes:
func (API) Create ¶
func (a API) Create(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
Create initiates a public or private channel-based conversation.
Based on: https://api.slack.com/methods/conversations.create
Channel names may only contain lowercase letters, numbers, hyphens, and underscores, and must be 80 characters or less.
Required Slack app scopes:
func (API) History ¶
func (a API) History(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
History returns the history of a conversation's (channel's) messages and events.
Based on: https://api.slack.com/methods/conversations.history
Required Slack app scopes:
func (API) Info ¶
func (a API) Info(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
Info returns information about a conversation (channel).
Based on: https://api.slack.com/methods/conversations.info
Required Slack app scopes:
func (API) Invite ¶
func (a API) Invite(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
Invite invites users to a channel.
Based on: https://api.slack.com/methods/conversations.invite
Required Slack app scopes:
- https://api.slack.com/scopes/channels:manage
- https://api.slack.com/scopes/channels:write.invites
- https://api.slack.com/scopes/groups:write
- https://api.slack.com/scopes/groups:write.invites
- https://api.slack.com/scopes/im:write
- https://api.slack.com/scopes/mpim:write
- https://api.slack.com/scopes/mpim:write.invites
func (API) List ¶
func (a API) List(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
List lists all the channels in a Slack team.
Based on: https://api.slack.com/methods/conversations.list
Required Slack app scopes:
func (API) Members ¶
func (a API) Members(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
Members retrieves all the members of a conversation (channel).
Based on: https://api.slack.com/methods/conversations.members
Required Slack app scopes:
func (API) Open ¶
func (a API) Open(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
Open opens or resumes a direct message or multi-person direct message.
Based on: https://api.slack.com/methods/conversations.open
Required Slack app scopes:
func (API) Rename ¶
func (a API) Rename(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
Rename a conversation (channel).
Based on: https://api.slack.com/methods/conversations.rename
Channel names may only contain lowercase letters, numbers, hyphens, and underscores, and must be 80 characters or less.
Required Slack app scopes:
func (API) Replies ¶
func (a API) Replies(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
Replies retrieves a thread of messages posted to a conversation (channel).
Based on: https://api.slack.com/methods/conversations.replies
Required Slack app scopes:
func (API) SetPurpose ¶
func (a API) SetPurpose(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
SetPurpose sets the purpose (description) for a conversation (channel).
Based on: https://api.slack.com/methods/conversations.setPurpose
Required Slack app scopes:
- https://api.slack.com/scopes/channels:manage
- https://api.slack.com/scopes/channels:write.topic
- https://api.slack.com/scopes/groups:write
- https://api.slack.com/scopes/groups:write.topic
- https://api.slack.com/scopes/im:write
- https://api.slack.com/scopes/mpim:write
- https://api.slack.com/scopes/mpim:write.topic
func (API) SetTopic ¶
func (a API) SetTopic(ctx context.Context, args []sdktypes.Value, kwargs map[string]sdktypes.Value) (sdktypes.Value, error)
SetTopic sets the topic for a conversation (channel).
Based on: https://api.slack.com/methods/conversations.setTopic
Required Slack app scopes:
- https://api.slack.com/scopes/channels:manage
- https://api.slack.com/scopes/channels:write.topic
- https://api.slack.com/scopes/groups:write
- https://api.slack.com/scopes/groups:write.topic
- https://api.slack.com/scopes/im:write
- https://api.slack.com/scopes/mpim:write
- https://api.slack.com/scopes/mpim:write.topic
type ArchiveRequest ¶
type ArchiveRequest struct { // ID of the conversation to archive. Required. Channel string `json:"channel"` }
type ArchiveResponse ¶
type ArchiveResponse struct {
api.SlackResponse
}
https://api.slack.com/methods/conversations.archive#examples
type Channel ¶
type Channel struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` NameNormalized string `json:"name_normalized,omitempty"` PreviousNames []string `json:"previous_name,omitempty"` Creator string `json:"creator,omitempty"` User string `json:"user,omitempty"` IsMember bool `json:"is_member,omitempty"` IsReadOnly bool `json:"is_read_only,omitempty"` IsThreadOnly bool `json:"is_thread_only,omitempty"` Topic *Topic `json:"topic,omitempty"` Purpose *Purpose `json:"purpose,omitempty"` LastRead string `json:"last_read,omitempty"` UnreadCount int `json:"unread_count,omitempty"` // A count of messages that the calling user has yet to read that matter to // them (excludes things like join/leave messages). UnreadCountDisplay int `json:"unread_count_display,omitempty"` IsArchived bool `json:"is_archived,omitempty"` IsChannel bool `json:"is_channel,omitempty"` IsFrozen bool `json:"is_frozen,omitempty"` IsGeneral bool `json:"is_general,omitempty"` IsGroup bool `json:"is_group,omitempty"` IsIM bool `json:"is_im,omitempty"` IsMPIM bool `json:"is_mpim,omitempty"` IsOpen bool `json:"is_open,omitempty"` IsPrivate bool `json:"is_private,omitempty"` ContextTeamID string `json:"context_team_id,omitempty"` PendingConnectedTeamIDs []string `json:"pending_connected_team_ids,omitempty"` Created int `json:"created,omitempty"` Updated int `json:"updated,omitempty"` Unlinked int `json:"unlinked,omitempty"` Latest *chat.Message `json:"latest,omitempty"` Locale string `json:"locale,omitempty"` NumMembers int `json:"num_members,omitempty"` Priority float32 `json:"priority,omitempty"` }
https://api.slack.com/types/conversation https://api.slack.com/methods/conversations.info#examples https://api.slack.com/methods/conversations.list#examples https://github.com/slackapi/slack-api-specs/blob/master/web-api ("objs_conversation")
type CloseRequest ¶
type CloseRequest struct { // ID of the conversation to close. Required. Channel string `json:"channel"` }
type CloseResponse ¶
type CloseResponse struct {
api.SlackResponse
}
type CreateRequest ¶
type CreateRequest struct { // Name of the public or private channel to create. Required. Name string `json:"name"` // IsPrivate indicates whether to create a private // channel instead of a public one. Default = false. IsPrivate bool `json:"is_private,omitempty"` // Team ID to create the channel in. Required if using an org token. TeamID string `json:"team_id,omitempty"` }
type CreateResponse ¶
type CreateResponse struct { api.SlackResponse Channel *Channel `json:"channel,omitempty"` }
type HistoryRequest ¶
type HistoryRequest struct { // Conversation ID to fetch history for. Required. Channel string `json:"channel"` // Cursor enables pagination through collections of data, based on the // [ResponseMetadata.NextCursor] attribute returned in the response to // the previous request. The default value ("") fetches the first page // of the collection. See https://api.slack.com/docs/pagination and // https://api.slack.com/methods/conversations.history#pagination-by-time. Cursor string `json:"cursor,omitempty"` // Limit is the maximum number of items to return. Fewer than that may // be returned, even if the end of the collection hasn't been reached. // Default = 100, maximum = 1000. Slack recommends no more than 200. Limit int `json:"limit,omitempty"` IncludeAllMetadata bool `json:"include_all_metadata,omitempty"` // Include messages with [Oldest] or [Latest] timestamps in results? // Default = 0. Ignored unless either timestamp is specified. Inclusive bool `json:"inclusive,omitempty"` // Only messages after this Unix timestamp will be included in results. // Default = 0. Oldest string `json:"oldest,omitempty"` // Only messages before this Unix timestamp will be included in results. // Default = current time. Latest string `json:"latest,omitempty"` }
type HistoryResponse ¶
type HistoryResponse struct { api.SlackResponse Messages []chat.Message `json:"messages,omitempty"` HasMore bool `json:"has_more,omitempty"` PinCount int `json:"pin_count,omitempty"` // Undocumented, always 0? ChannelActionsCount int `json:"channel_actions_count,omitempty"` }
https://api.slack.com/methods/conversations.history#examples
type InfoResponse ¶
type InfoResponse struct { api.SlackResponse Channel *Channel `json:"channel,omitempty"` }
type InviteRequest ¶
type InviteRequest struct { // ID of the public or private channel to invite user(s) to. Required. Channel string `json:"channel"` // Comma-separated list of user IDs. Up to 1000 users may be listed. Required. Users string `json:"users"` // When set to true and multiple user IDs are provided, continue inviting // the valid ones while disregarding invalid IDs. Defaults to false. Force bool `json:"force,omitempty"` }
type InviteResponse ¶
type InviteResponse struct { api.SlackResponse Channel *Channel `json:"channel,omitempty"` Errors []Error `json:"errors,omitempty"` }
type ListResponse ¶
type ListResponse struct { api.SlackResponse Channels []Channel `json:"channels,omitempty"` }
type MembersResponse ¶
type MembersResponse struct { api.SlackResponse Members []string `json:"members,omitempty"` }
https://api.slack.com/methods/conversations.members#examples
type OpenRequest ¶
type OpenRequest struct { // Resume a conversation by supplying an IM or MPIM's ID. // Or provide the "users" field instead. Channel string `json:"channel,omitempty"` // Comma-separated list of user IDs. If only one user is included, this creates // a 1:1 DM. The ordering of the users is preserved whenever a multi-person // direct message is returned. Supply a channel when not supplying users. Users string `json:"users,omitempty"` // Do not create a direct message or multi-person direct message. // This is used to see if there is an existing DM or MPDM. PreventCreation bool `json:"prevent_creation,omitempty"` // Indicates you want the full IM channel definition in the response. ReturnIM bool `json:"return_im,omitempty"` }
type OpenResponse ¶
type OpenResponse struct { api.SlackResponse Channel *Channel `json:"channel,omitempty"` Errors []Error `json:"errors,omitempty"` }
type RenameRequest ¶
type RenameResponse ¶
type RenameResponse struct { api.SlackResponse Channel *Channel `json:"channel,omitempty"` }
type RepliesResponse ¶
type RepliesResponse struct { api.SlackResponse Messages []chat.Message `json:"messages,omitempty"` HasMore bool `json:"has_more,omitempty"` }
https://api.slack.com/methods/conversations.replies#examples
type SetPurposeRequest ¶
type SetPurposeResponse ¶
type SetPurposeResponse struct {
api.SlackResponse
}
https://api.slack.com/methods/conversations.setPurpose#examples
type SetTopicRequest ¶
type SetTopicResponse ¶
type SetTopicResponse struct {
api.SlackResponse
}
https://api.slack.com/methods/conversations.setPurpose#examples
type UnarchiveRequest ¶
type UnarchiveRequest struct { // ID of the conversation to unarchive. Required. Channel string `json:"channel,omitempty"` }
type UnarchiveResponse ¶
type UnarchiveResponse struct {
api.SlackResponse
}
https://api.slack.com/methods/conversations.unarchive#examples