Host Line Bot with Golang
-
Upload
evan-lin -
Category
Technology
-
view
195 -
download
1
Transcript of Host Line Bot with Golang
Host Line Bot on Heroku with Golang
Evan Lin
Agenda• Line Bot API Capability and Limitation
• Setup Line Bot Trial on Heroku
• Advance usage:
• Send a picture, when user type some text.
• Create a “Hello” message when add your bot as new friend.
• Project Demo: Line Bot
Line Bot Capability and Limitation
• No Rich message (Link message)
• No dashboard
• Cannot talk with multiple People
• Cannot invite into chat room
Step 1: Request Line Bot Trial AccountApply Line Bot trial account here
(Only 1 per Line Account)
Step 2: Deploy to Heroku by one click
Link : https://github.com/kkdai/LineBotTemplate
Step 2: Deploy to Heroku by one click
Remember this addreess
Step 3: Setup Fixed IP for white list (not mandatory)
• NOT MANDATORY! (Let empty also works)
• Two ways to setup Fixie in Heroku
• Using Heroku Dashboard
• Using Heroku Toolbelt
Step 3: Setup Fixed IP for white list (not mandatory)
• Through Heroku dashboard:
• Launch Heroju dashboard
• Go your deploy app page
• Go to “Resource"
• Go to "FIND MORE ADD-ONS”
• Find “Fixie"
• Through Heroku Toolbelt
Step 3: Setup Fixed IP for white list (not mandatory)
• Through Heroku Toolbelt
• $ heroku login
• $ heroku git:clone -a <YOUR_HEROKU_APP_ID>
• $ cd linebotkkdaitest
• $ heroku addons:create fixie:tricycle
Step 4. Fill your Heroku App Callback address to Line Bot
• Copy your app address from Heroku to Line Dashboard.
• It will be something like “ https://xxxxxx.herokuapp.com:443/callback”
Fill your app dress here
Step 5. Get related Line Bot info for Heroku App setting
• Need copy following variable:
• Channel ID
• Channel Secret
• MID
Need copy those three
Step 6. Fill your Line Bot Information to Heroku Variables• In Heroku [Dashboard] ->
[Settings]-> [Config Variables]
• Create following variables:
• ChannelID
• ChannelSecret
• MID
• Fill with you just got from Line Bot Dashboard.
Send a Image to user
Parse bot request to received result
Send a Image to user
Make sure it is text message not operation
Send a Image to user
Send image to who text to the bot
“Hello” message from Line Bot
Hello
Send a “Hello” message when add bot as friend
Determine the operation type
Send a “Hello” message when add bot as friend
Get request from ID, this is only way for now
Live Demohttps://github.com/kkdai/LineBotPetNeedMe
Q&A