An opinionated boilerplate for building Line Messenger Chatbot.
Why you should use this boilerplate instead of their plain example code.
Click the button below to deploy it to heroku.
Login with your Line account, go through then create a new bot follow this guide. There are 3 kinds of accounts, developer trial, Free account and Premium account. If you choose developer trial, you can use LINE
push message API. However, your bot can only have up to 50 friends. If you choose Free account, you are unable to use LINE
push message API. Your bot may have unlimited friends with this account type. If your bot want to use LINE
push message API & unlimited friends, you need to choose Free account and upgrade the account to premium account later.
According to line dashboard, the premium account is free until 30 january 2018. You just need to put your credit card number to use premium account without any charge.
Open your developer console, choose one of your bots. On Channel Secret section click issue. Don't forget to note Channel ID and Channel Access Token too.
Make sure you have register yourself on heroku. Deploy this boilerplate to heroku by clicking the heroku button above. Fill Channel Secret, Channel ID and Channel Access Token form with the value retrieved in previous step. You may choose whatever App Name you like but you need to remember this for the next step.
Heroku will serve your bot using your App Name so it will be available under https://[YOUR_APP_NAME].herokuapp.com
Open your developer console, choose one of your bots. Go through Message Setting section. Enable Webhook by clicking the pen logo in the right and choose
Enabled. In the next section, click pen icon, edit Webhook URL with your App Name you've choosen in previous step. Fill it with the following format
https://[YOUR_APP_NAME].herokuapp.com/webhook . So if your App Name in step 3 equal to
my-example-bot then you need to fill this input with
Install Heroku CLI , login to your heroku account by running this command :
clone your app, assumming that your App Name is
my-example-bot, then you need to clone it to your local machine :
heroku git:clone -a my-example-bot cd my-example-bot
Modify the bot code, read this general guideline
.env.example , rename it to
.env, edit the
.env file put your Channel Secret, Channel ID and Channel Access Token there.
To test your bot locally, you have to run this command :
npm run dev
Then follow the tutorial described here, (you can simply skip step 1 & 2, go through step 3 there).
You can follow normal heroku workflow :
git add . git commit -am "your commit message" git push heroku master