Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
slack mini "sniffer", connects to slack and outputs the messages received over the slack websocket
package main
import (
"fmt"
"github.com/nlopes/slack"
)
func main() {
// create new slack object & connect
api := slack.New("TOKEN_REDACTED")
api.SetDebug(true)
rtm := api.NewRTM()
// lets do it
go rtm.ManageConnection()
// loop() and listen for inbound messages
for {
select {
case msg := <-rtm.IncomingEvents:
fmt.Print("Event Received: ")
fmt.Printf(" %s\n", msg.Data)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.