code: def get_slack_channels(self, token):
          '''
          Get all channel names from Slack
          '''
  
          ret = salt.utils.slack.query(
              function='rooms',
              api_key=token,
              # These won't be honored until https://github.com/saltstack/salt/pull/41187/files is merged
              opts={
                  'exclude_archived': True,
                  'exclude_members': True
              })
          channels = {}
          if 'message' in ret:
              for item in ret['message']:
                  channels[item['id']] = item['name']
          return channelf get_slack_channels(self, token):
          '''
          Get all channel names from Slack
          '''
  
          ret = salt.utils.slack.query(
              function='rooms',
              api_key=token,
              # These won't be honored until https://github.com/saltstack/salt/pull/41187/files is merged
              opts={
                  'exclude_archived': True,
                  'exclude_members': True
              })
          channels = {}
          if 'message' in ret:
              for item in ret['message']:
                  channels[item['id']] = item['name']
          return channels
docs: Get all channel names from Slack