func InitAPI(token string) {
	api = slack.New(token)
	res, err := api.AuthTest()
	failOnError(err, "Slack API Error")
	output(fmt.Sprintf("connected to %s as %s", res.Team, res.User))
}
InitAPI for Slack
package main
import (
	"fmt"
	"time"
	"github.com/slack-go/slack"
)
var (
	api     *slack.Client
	msgOpts = &slack.PostMessageParameters{AsUser: true}
)