Spaces:
Running
on
Zero
Running
on
Zero
class LineApi { | |
/** | |
* Send a request to LINE API | |
* @param {string} endpoint | |
* @param {object} payload | |
* @return {object} response | |
*/ | |
function sendRequest(endpoint, payload) { | |
var options = { | |
"method": "POST", | |
"headers": { | |
"Authorization": "Bearer YOUR_ACCESS_TOKEN", | |
"Content-Type": "application/json" | |
}, | |
"payload": JSON.stringify(payload) | |
}; | |
var response = UrlFetchApp.fetch("https://api.line.me/v2/" + endpoint, options); | |
return JSON.parse(response.getContentText()); | |
} | |
} |