You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
804 B

package main
import (
"fmt"
"github.com/nlopes/slack"
)
var (
apiToken = ""
)
// this is for testing.
func startSlackConnection() {
var (
postAsUserName string
postAsUserID string
postToUserName string
postToUserID string
postToChannelID string
)
api := slack.New(apiToken)
authTest, err := api.AuthTest()
if err != nil {
fmt.Printf("Error getting channels: %s\n", err)
return
}
// Post as the authenticated user.
postAsUserName = authTest.User
postAsUserID = authTest.UserID
// Posting to DM with self causes a conversation with slackbot.
postToUserName = authTest.User
postToUserID = authTest.UserID
Log.Info(fmt.Sprintf("Posting as %s (%s) in DM with %s (%s), channel %s\n", postAsUserName, postAsUserID, postToUserName, postToUserID, postToChannelID))
}