calculquebec / CQORC

CQORC: Calcul Québec One Ring Coordinator, one ring to rule them all
MIT License
4 stars 0 forks source link

Bulking requests to Slack's conversation listing #88

Closed mboisson closed 7 months ago

mboisson commented 7 months ago

When archiving multiple channels at the end of the session, we run into

Error listing conversations: The request to the Slack API failed. (url: https://www.slack.com/api/conversations.list)
The server responded with: {'ok': False, 'error': 'ratelimited'}
Error archiving channel: The request to the Slack API failed. (url: https://www.slack.com/api/conversations.archive)
The server responded with: {'ok': False, 'error': 'invalid_arguments', 'response_metadata': {'messages': ['[ERROR] missing required field: channel']}}

That is likely because we do multiple calls to conversations.list, one per channel, to retrieve the channel ID to archive. To avoid this, we should bulk the calls to extract the multiple channel IDs and then iterate to archive the conversations.