Vizag
Vizag

Reputation: 773

Slack API: Creating group thru groups.create doesn't reflect in conversations.list

I am working with slack API to create channels for my team thru its API.

There are some channels on the team that have been created using the web UI and some that I have created using groups.create method.

When I fetch the list of channels using conversations.list method, the groups/channels that I created using groups.create aren't fetched!! Why?

sc = slack_client()
res = sc.api_call("conversations.list", exclude_archived=1, types=['private_channel'])

And how do I fetch the channels created using groups.create?

Upvotes: 1

Views: 69

Answers (1)

Vizag
Vizag

Reputation: 773

Resolved the issue.

Actually the number of groups had exceeded 100 and the default length of response in conversations.list is 100. Just had to tweak the limit parameter passed in conversations.list to get all the channels.

Initially I was using:

sc = slack_client()
res = sc.api_call("conversations.list", exclude_archived=1, types=['private_channel'])

Now I changed it to

sc = slack_client()
res = sc.api_call("conversations.list", exclude_archived=1, types=['private_channel'], limit= 999)

Upvotes: 1

Related Questions