persimmon0330
@persimmon0330

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

slack apiのconversations.listとGASを使用して、プライベートチャンネルのリストを取得したい

解決したいこと

slack.apiで全private_channelのリストを取得したい。

発生している問題・エラー

取得できず、空の値が返ってくる。

該当するソースコード


token = hogehoge~~:

function GetChannelInfo(){
  var url = "https://slack.com/api/conversations.list";
  var token_ = "?token=" + token;
  var archived = "&exclude_archived="+true;
  var types = "&types="+"private_channel";// 取得するチャンネルタイプ
  var limit = "&limit=999";
  const options1 = {"headers": { 'Authorization': 'Bearer ' + token }
};
  var response = UrlFetchApp.fetch(url+token_+archived+types+limit,options1);
  var channelsInfo = JSON.parse(response).channels;
  return channelsInfo;
}

自分で試したこと

conversations.listのtesterでは正常に取得できているのに、GASでは取得できない。

channels:read
groups:read
im:read
mpim:read
のtokenは追加できているはず

0

No Answers yet.

Your answer might help someone💌