title: How to get the all the channels in Slack workspace with conversation.list API?
body: <p>When I paginate through next_cursor, I get a different number of channels every time I hit the URL through NodeJS function. </p>
  
  <p>Once the total channels fetched is 7488 another time it is 300. It differs every time I run the program.</p>
  
  <pre><code>URL : https://slack.com/api/conversations.list?types=public_channel&amp;cursor={cursor}=&amp;exclude_archived=true&amp;token={token}
  </code></pre>
  
  <p>The issue is due to the rate limit of slack. conversation.list comes under tier 2 rate limit. That is only maximum 20 requests per minute. </p>
  
  <pre><code>function fetchData(){
    getResponse(url);
      function getResponse(url) {
  
          let tempData = '';
  
          https.get(url, (resp) =&gt; {
  
  
              resp.on('data', (chunk) =&gt; {
                  tempData += chunk;
              });
  
              resp.on('end', () =&gt; {
                  try{
                      tempData = JSON.parse(tempData);
                      if(tempData.channels){
                          resultData.push(tempData.channels);
                      }
  
                      if (tempData.response_metadata &amp;&amp; tempData.response_metadata.next_cursor) {
                          if(tempData.response_metadata.next_cursor === ''){
                              return resultData;
                          }
                          let cursorIndex = url.indexOf('cursor');
                          let newUrl = url.slice(0,cursorIndex);
                          let token = apiConstants.SLACK_API['ACCESS_TOKEN'];
                          let nextCursor = tempData.response_metadata.next_cursor.slice(0,tempData.response_metadata.next_cursor.length-1);
                          nextCursor = nextCursor + "%3D";
                          newUrl = newUrl + 'cursor=' + nextCursor + '&amp;token='+ token;
                          getResponse(newUrl);
                      } else {
  
                          return resultData;
                      }
                  }catch(err){ console.log(err);} } } }
  </code></pre>