Title1

Title2

Title3

4-5 取得群組中的用戶數

 


/*============================================
  得到 群組中的用戶數
  GET https://api.line.me/v2/bot/group/{groupId}/members/count
============================================*/
function getLineGroupCount(groupId){
  let response,relute;
  try {       
    response = UrlFetchApp.fetch("https://api.line.me/v2/bot/group/"+groupId+"/members/count", {
      "method": "GET",
      "headers": {
        "Authorization": 'Bearer ' + CHANNEL_ACCESS_TOKEN,
        "Content-Type": "application/json"
      },
    });
    relute = JSON.parse(response); // 解析 json
  }catch(e){    
    relute = {
      count: ''
    };
    console.log(e)
  }
  // console.log(relute)
  return relute.count;
}