Giter Club home page Giter Club logo

line-chatbot-boilerplate's Introduction

Line Messenger Chat Bot Boilerplate

An opinionated boilerplate for building Line Messenger Chatbot.

Key Features

Why you should use this boilerplate instead of their plain example code.

  1. It supports Hot Module Replacement so you can code effectively without restarting the server over and over again.
  2. Better abstraction separate between logical operation, state/data manipulation and presentation layer.
  3. Ability to test the bot locally. Immediately test your bot from your local computer without pushing to heroku.
  4. Ability to simulate multiple user simultaneously.
  5. Ability to test your bot even if you don't have any smartphone.

Click the button below to deploy it to heroku.

Deploy

Showcase / Examples

  • Mastermind chatbot (in Production, you can simply add him using this line ID @rgr5367i)
    Demo

How to use

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.

2. Get your Line Secret Token

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.

3. Deploy the app to heroku

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

4. Update Line Messenger Configuration to Link the bot on heroku

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 https://my-example-bot.herokuapp.com/webhook.

5. Clone to local

Install Heroku CLI , login to your heroku account by running this command :

heroku login

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

6. Modify your code

Modify the bot code, read this general guideline

7. Test Your code locally

Copy .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).

8. Deploy changes to heroku

You can follow normal heroku workflow :

git add .
git commit -am "your commit message"
git push heroku master

line-chatbot-boilerplate's People

Contributors

fawwaz avatar juniarta avatar k1m0ch1 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.