This is sample code to demostration LINE chatbot account link, refer to document https://developers.line.biz/en/docs/messaging-api/linking-accounts/
You could see each step mark in comment (from step 1 to 12)
- The bot server calls the API that issues a link token from - the LINE user ID.
- The LINE Platform returns the link token to the bot server.
- The bot server calls the Messaging API to send a linking URL to the user.
- The LINE Platform sends a linking URL to the user.
- The user accesses the linking URL.
- The web server displays the login screen.
- The user enters his/her credentials.
- The web server acquires the user ID from the provider's service and uses that to generate a nonce.
- The web server redirects the user to the account-linking endpoint.
- The user accesses the account-linking endpoint.
- The LINE Platform sends an event (which includes the LINE user ID and nonce) via webhook to the bot server.
- The bot server uses the nonce to acquire the user ID of the provider's service.
- Create your LINE Developer account and create a developer trial account.
- Deploy this project to heroku
- You need to fill following configuration during you create project.
- LINECORP_PLATFORM_CHANNEL_CHANNELSECRET
- LINECORP_PLATFORM_CHANNEL_CHANNELTOKEN
- LINECORP_PLATFORM_CHANNEL_SERVERURL
- You need to fill following configuration during you create project.
- Update the webhook url with https://xxx.herokuapp.com/callback in LINE developer
- Done
If you don't want to deploy your own LINE account link chatbot, you can click follow to add friend
- Input any test will show quick reply "account link" and "list user"
- Input "list user"
- Click link of "list user" will display all user from provider website.
�- Click "Click link to completed account link" to link your account to chatbot.
- Close browser
- Chatbot already link to your account, input any text will show your information.