Created
March 5, 2016 00:32
-
-
Save rickt/856ba20300badfcfe36f to your computer and use it in GitHub Desktop.
slack mini "sniffer", connects to slack and outputs the messages received over the slack websocket
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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