/*============================================
用 「userId」得到 Line User Data
============================================*/
function getLineUser(userId){
let response,lineUser;
try {
response = UrlFetchApp.fetch("https://api.line.me/v2/bot/profile/"+userId, {
"method": "GET",
"headers": {
"Authorization": 'Bearer ' + CHANNEL_ACCESS_TOKEN,
"Content-Type": "application/json"
},
});
lineUser = JSON.parse(response); // 解析 json
}catch(e){
lineUser = {
userId:'',
displayName:'',
statusMessage:'',
language:'',
pictureUrl:''
}
}
// console.log(lineUser);
return lineUser;
}