Skip to content

Instantly share code, notes, and snippets.

@tandevmode
Created June 6, 2018 03:12
Show Gist options
  • Save tandevmode/a42ce4fc2b7d69cc4cf8b6289612ae6b to your computer and use it in GitHub Desktop.
Save tandevmode/a42ce4fc2b7d69cc4cf8b6289612ae6b to your computer and use it in GitHub Desktop.
เรียกใช้ LIFF API
liff.getProfile().then(function (profile) {
liff.sendMessages([
{
type: 'image',
originalContentUrl: 'https://' + document.domain + '/imgs/' + res + '.jpg',
previewImageUrl: 'https://' + document.domain + '/imgs/' + res + '_240.jpg'
},
{
type: 'text',
text: 'From:' + profile.displayName
}
]).then(function () {
liff.closeWindow();
}).catch(function (error) {
window.alert('Error sending message: ' + error.message);
});
}).catch(function (error) {
window.alert("Error getting profile: " + error.message);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment