Skip to content

00A Setting Up (Local Development)

JCxYIS edited this page Nov 20, 2021 · 5 revisions

Sign Up for Required Accounts

Install Required Tools

Register a bot on Line Developers

  • Go to https://developers.line.biz/ and sign in to your account

  • Choose an existing provider, or create a new one

    A provider is an individual developer, company, or organization that provides services. (See Document)

  • Create a new channel

  • Select "Messaging API"

  • Complete the form and press Create

Copy this Project

  • If you have Github account, you can fork this project and clone
  • Otherwise you may just do clone from here or Download zip directly

Deploy to Heroku

  • Open the terminal (For example, powershell in Windows)
  • Navigate to the project folder (For example, I put the code in F:\LineBot-IoT)
cd F:\LineBot-IoT
  • Login to your heroku account (You may be prompted "Press any key to continue", then you will be directed to the login site)
heroku login
  • Create an app on heroku (You can name the app yourself. In my case, I named it my-cool-iot-linebot)
heroku create my-cool-iot-linebot
  • Put the API keys in that app: Go to Line Developers, select the bot you created, fill in the commands below with these keys and run it.
heroku config:set LINEBOT_CHANNEL_ACCESS_TOKEN=...
heroku config:set LINEBOT_CHANNEL_SECRET=...

Channel access token is in "Messaging API" section
Channel Secret is in "Basic Settings" section

  • Push the code to heroku
git push heroku master

Tell Line where our bot is

Test your effort!

  • Try send some message to the bot! It should response with "Hello World! ..."

The link to your bot is in "Messaging API" section of Line Developers Console

  • If you see message other message appear with that, please check auto-reply setting in Line Developer Console

Apply change to Heroku

Automatic Deploy

See https://github.com/JCxYIS/LineBot-IoT/wiki/00---Setting-Up-(no-install)#bind-heroku-with-your-github-account

Manual Deploy

  • Each time you edit the project, you need to deploy it in order to see the change take effects
  • Deploy commands are
git add -A 
git commit -m "DESCRIBE WHAT DID YOU DO SINCE LAST CHANGE HERE"
git push heroku