Created
June 6, 2018 03:12
-
-
Save tandevmode/a42ce4fc2b7d69cc4cf8b6289612ae6b to your computer and use it in GitHub Desktop.
เรียกใช้ LIFF API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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