Skip to content

slack channel for large workspaces #203

Description

@mraklay

Hi there
Thanks for making this project open source!

I'm setting it up for the first time and encountered an error sending alerts to Slack. However, email alerts still work.
A little research revealed that the Slack method
conversations_list from slack.py

response = client.conversations_list(types="public_channel,private_channel")
channels = response["channels"]

doesn't return all available channels from my workspace, but rather a limited list. My workspace has over 100 channels, so I was getting an error.
Channel not found

Explicitly adding a limit helped:

channels = []
cursor = None
while True:
    response = client.conversations_list(
        types="public_channel,private_channel",
        limit=1000,
        cursor=cursor
    )
    channels.extend(response["channels"])
    cursor = response.get("response_metadata", {}).get("next_cursor")
    if not cursor:
        break

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions