Closed jacklee814 closed 5 years ago
@jacklee814 You need to do that within the callback function. For example,
let username;
event.source.profile().then(function (profile) {
username = profile.displayName;
console.log(username);
});
Ok. thank you
btw do you know why some user displayName is 'undefined' ?, but some user was normal.
@jacklee814 I've seen that sometimes too, and also cannot find any answer from their documentation. My guess is that those users haven't accepted the terms and conditions. They may use older version of LINE, or they may just chat to the bot without adding it as friend.
thanks for your reply.
in the Event.source.profile(), I cant save the username to a variable from profile.displayName?
like this ...