Skip to content

how to get Channel ID from Channel Name Input? #1026

Answered by kholisrag
kholisrag asked this question in Q&A
Discussion options

You must be logged in to vote

https://api.slack.com/methods/conversations.info method can used if we known the channel ID,
what I want is input the channel name, and get the channel ID,

anyway fixed with looping method something like this :

	for {
		listChannel, c, err := c.GetConversations(&slack.GetConversationsParameters{
			ExcludeArchived: true,
			Limit:           200,
			Types:           []string{"public_channel", "private_channel"},
			Cursor:          cursor,
		})
		if err != nil {
			logrus.WithField("error_message", err).Error("Unable to Get Channel List")
			break
		}

		if c != "" {
			cursor = c
			logrus.Infof("Searching Next Cursor %v", cursor)

			found := false
			for _, ch := range listChannel {
			…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kanata2
Comment options

Answer selected by kanata2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants