Thank you for the advice.
First, I opened the liff url. Next, the result of running liff.login().
liff.login()
VM77:1 Uncaught ReferenceError: liff is not defined
at <anonymous>:1:1
However, it works on heroku. LIFF started on heroku could also execute liff.sendmessages.
Or just post it. I can help you debug this problem.
How kind of you are!
But I'm sorry, I'm already using heroku. I hope to someday solve the problems with GAS for everyone else.
By the way, I heard this story. It seems that HTML created on GAS cannot embed JavaScript, and it is necessary to import an external .gs file. I don't have time to try it right now.
- 0
Error: Need access_token for api call, Please login first
I saw this error message. Don't you login?
Try this command at Chrome Console liff.login()
After login and try send message again.
But the solution above is able when not using Line Client. Check your liff url. Or just post it. I can help you debug this problem.
- 1
It was as I expected. I deployed the same code to heroku and it worked as expected.
I want the evolution of Google Apps Script.
thank you.
- 0
I tried it. I used the extension LINE of Google Chrome. However, when I access it from Google Chrome, the in-app web browser cannot be used and the external browser starts. There is a restriction that liff.sendMessages cannot be used from external browsers. :-(
I am fixing the html so I will present it. <script>
is written in<body>
.
<script>
window.onload = function() {
console.log('window onload start');
initializeLiff("__MY_LIFF_ID__");
console.log('window onload end');
}
function initializeLiff(myLiffId) {
console.log('initializeLiff start');
liff
.init({
liffId: myLiffId
})
.then(() => {
console.log('sendMessages Load start');
document.getElementById("sendbutton").addEventListener('click', () => {
/*
test
if (!liff.isInClient()) {
console.error('sendError!! code:001');
} else {
*/
liff.sendMessages([{
type: 'text',
text: 'this is test message.'
}]).then(function() {
console.log('send completed.');
}).catch(function(error) {
console.error('sendError!! code:002',error);
});
/*
}
*/
});
console.log('sendMessages Load completed.');
})
.catch((err) => {
console.error('initializeLiffError!! code:003',err);
});
console.log('initializeLiff end');
}
</script>
console log here.
window onload start
userCodeAppPanel:9 initializeLiff start
userCodeAppPanel:35 initializeLiff end
userCodeAppPanel:5 window onload end
userCodeAppPanel:15 sendMessages Load start
userCodeAppPanel:30 sendMessages Load completed.
userCodeAppPanel:25 sendError!! code:002 Error: Need access_token for api call, Please login first
at new t (sdk.js:2)
at Q (sdk.js:2)
at Ye (sdk.js:2)
at Object.sendMessages (sdk.js:2)
at HTMLButtonElement.<anonymous> (userCodeAppPanel:19)
I'm continuing to check if the same script works on heroku.
- 0
That's a great idea. I was only checking in a LINE application running on a smartphone. I'm thinking of trying out Google Chrome developer tools. At the same time, I will consider vConsole.
I'm sorry, but I don't know when the results will come out. Because it is not my main business. I'll update this article when the results come out. Thank you very much.
- 0
開発者ツールにエラーメッセージがありませんが? 見せでくれませんか?
- 1