func listChannels() (names []string) {
	list, err := getConversations("public_channel", "private_channel")
	failOnError(err)
	for _, c := range list {
		names = append(names, c.Name)
	}
	return names
}
Return list of all channels by name
package main
import (
	"fmt"
	"time"
	"github.com/slack-go/slack"
)
var (
	api     *slack.Client
	msgOpts = &slack.PostMessageParameters{AsUser: true}
)
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))
}