Spaces:
Running
on
Zero
Running
on
Zero
File size: 550 Bytes
275b9f3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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());
}
} |