slack

package
v0.0.0-...-821ef61 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package slack is a Connection to the Slack Real Time Messaging API (https://api.slack.com/rtm). To use this connection, you will need to create a custom bot user. See https://api.slack.com/bot-users#custom_bot_users.

Once you've created a bot user, you will need to initialize the Slack connection using the API key for this bot user.

slackConnection := NewConnection("MySlackBotAPIKey")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Token string
	Inbox map[int]Message
}

Connection provides an interface for storing the Slack API key and the inbox for storing received messages

func NewConnection

func NewConnection(slackAPIKey string) *Connection

NewConnection returns a new Connection to Slack

func (*Connection) Start

func (s *Connection) Start(errorChannel chan error) (rx, tx message.BasicChannel)

Start creates the connection for the Slack RTM and creates the transmit and receive goroutines that listen and send messages through the tx and rx channels

type Message

type Message struct {
	message.Basic
	Type      string `json:"type"`
	Channel   string `json:"channel"`
	User      string `json:"user"`
	Timestamp string `json:"ts"`
}

Message provides the interface for all Slack messages

Jump to

Keyboard shortcuts

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