Created
August 12, 2024 17:13
-
-
Save Niraj-Fonseka/10e97ec4b88a19c43714b4f5a3edd002 to your computer and use it in GitHub Desktop.
Remove a slack bot from all the channels it's added to
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from slack_bolt import App | |
import time | |
app = App(token="") | |
resp = app.client.users_conversations() | |
channel_ids_to_skip = [] | |
for c in resp["channels"]: | |
channel_id = c["id"] | |
channel_name = c["name"] | |
print(f"channel_id {channel_id}, channel_name {channel_name}") | |
if channel_id in channel_ids_to_skip: | |
print(f"---> skipping {channel_name}") | |
continue | |
resp = app.client.conversations_leave(channel=c["id"]) | |
print(resp) | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment