Skip to content

conversations_list does not return newly created public channels #1159

Closed

Description

@gagantrivedi

Reproducible in:

The Slack SDK version

slack-sdk==3.13.0

Python runtime version

Python 3.9.7+

OS info

Linux gpad 5.15.12-arch1-1 #1 SMP PREEMPT Wed, 29 Dec 2021 12:04:56 +0000 x86_64 GNU/Linux

Steps to reproduce:

  1. Create an app add it to the workspace with the following scope
    image

  2. Fetch the channels using the below code

client = WebClient(token=bot_token)
        client.retry_handlers.append(RateLimitErrorRetryHandler(max_retry_count=3))
        response = client.conversations_list(
            exclude_archived=True,
            limit=200,
            types="public_channel, private_channel, mpim, im",
        )

  1. Observe that all the newly(1 hr ago) created channels are missing

Expected result:

Should return all the channels

Actual result:

Only returns some public channels

Activity

  1. added
    questionM-T: User needs support to use the project
    and removed on Jan 5, 2022
  2. misscoded commented on Jan 6, 2022

    @misscoded
    Contributor

    Hi @gagantrivedi! I went ahead and spent some time trying to reproduce the issue you've described. The only case in which channels returned were "missing" were those channels that were 1.) private and 2.) the app hadn't been added to.

    Of the ones that you notice are missing, do they all share the two characteristics listed above?

  3. seratch commented on Jan 6, 2022

    @seratch
    Contributor

    @gagantrivedi
    To add to the things Alissa mentioned, I guess the Slack API pagination might confuse you.

    Your newly created channel can be included in a following page of the API response pagination. If response_metadata.next_cursor in an API response is not empty, conversations.list API has more to return. See also: #1074 (comment)

    This Python SDK offers a handy way to iterate with the Slack API pagination. Checking this test code should be helpful to know how to use it.

  4. gagantrivedi commented on Jan 6, 2022

    @gagantrivedi
    Author

    Yeah, it was related to pagination. Thanks, @seratch @misscoded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionM-T: User needs support to use the project

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions