Documentation ¶
Index ¶
- Constants
- func CreateNewConversation(token, conversationName string, isPrivate bool) (string, error)
- func DialWS(config *ws.Config) (conn *ws.Conn, err error)
- func FindDMByUserID(token, userID string) (string, error)
- func GetConversationMembers(token, chanID string) ([]string, error)
- func InitWSConfig(token string) (config *ws.Config, userID string, err error)
- func InviteMembersToConversation(token, chanID string, memberIDs []string) error
- func SendAPIMessage(token, chanID, message string) error
- func SendWSMessage(conn *ws.Conn, m Message) error
- type Conversation
- type IM
- type Message
- type TopicInfo
- type UserProfile
Constants ¶
const ( TypeMessage = "message" UserInviteLimit = 30 )
Slack consts
Variables ¶
This section is empty.
Functions ¶
func CreateNewConversation ¶
CreateNewConversation creates new Slack conversation and returns its ID and error, if any
func FindDMByUserID ¶
FindDMByUserID returns Slack IM ID for the provided user ID
func GetConversationMembers ¶
GetConversationMembers returns the Slack conversation member list by conversation ID
func InitWSConfig ¶ added in v1.0.4
InitWSConfig creates a websocket-based Real Time API session and returns the websocket config and the ID of the bot/user whom the token belongs to.
func InviteMembersToConversation ¶
InviteMembersToConversation adds members from the slice to the Slack conversation
func SendAPIMessage ¶
SendAPIMessage sends a message with Web API
Types ¶
type Conversation ¶
type Conversation struct { ID string `json:"id"` Name string `json:"name"` Created int64 `json:"created"` IsArchived bool `json:"is_archived"` IsGeneral bool `json:"is_general"` Creator string `json:"creator"` NameNorm string `json:"name_normalized"` IsReadOnly bool `json:"is_read_only"` IsMember bool `json:"is_member"` IsPrivate bool `json:"is_private"` Topic TopicInfo `json:"topic"` Purpose TopicInfo `json:"purpose"` }
Conversation describes Slack conversation
func GetConversationInfo ¶
func GetConversationInfo(token, chanID string) (*Conversation, error)
GetConversationInfo returns info about the Slack conversation by its ID
func GetConversations ¶
func GetConversations(token string, withArchived bool) ([]Conversation, error)
GetConversations returns info about all of the public and private Slack conversations in the workspace
type IM ¶
type IM struct { ID string `json:"id"` Created int64 `json:"created"` IsIM bool `json:"is_im"` User string `json:"user"` IsUserDeleted bool `json:"is_user_deleted"` }
IM describes Slack instant message channel
type Message ¶
type Message struct { ID uint64 `json:"id"` User string `json:"user,omitempty"` Type string `json:"type"` Conversation string `json:"channel"` Text string `json:"text"` }
Message describes Slack messages
type TopicInfo ¶
type TopicInfo struct { Value string `json:"value"` Creator string `json:"creator"` LastSet int64 `json:"last_set"` }
TopicInfo describes topic or purpose
type UserProfile ¶
type UserProfile struct { ID string `json:"id,omitempty"` Title string `json:"title"` Phone string `json:"phone"` Skype string `json:"skype"` // used for birthday dates RealName string `json:"real_name"` RealNameNorm string `json:"real_name_norm"` DisplayName string `json:"display_name"` DisplayNameNorm string `json:"display_name_norm"` Email string `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` ImageOriginal string `json:"image_original"` }
UserProfile describes Slack user profile
func GetUserProfile ¶
func GetUserProfile(token, userID string) (*UserProfile, error)
GetUserProfile returns the Slack user's profile by user ID