Skip to content

andyrochi/PocketCafeList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pocket Cafe List LINE bot

Readme still in progress...

A simple LINE bot that lets you save nearest cafes in your pocket. Simply create data.json under data/ following the example.json, and see data/README.md for more.

Features

  • Data is decoupled from code/control flow, thus making both easier to maintain
  • Supports chat history feature, so if you created a back button on any flex message (or simply just typed back in the chat), we can retrieve previously sent message
  • If the text entered by the user does not correspond to any key in data/data.json, the home card will be returned

How to use

Clone the repo

$ git clone https://github.com/andyrochi/self-promo-line-bot.git

Install dependencies

$ npm install

Create menus/data

$ mv data/example.json data/data.json

Configuration

Develop

During development, create a .env file with the contents below:

CHANNEL_ACCESS_TOKEN = {YOUR_CHANNEL_SECRET}
CHANNEL_SECRET = {YOUR_CHANNEL_ACCESS_TOKEN}

You may use ngrok to test your LINE bot locally during development. Simply enter the command below:

$ ngrok http {PORT}

The port will be thus forwarded to a global address.

Production

$ export NODE_ENV=production
$ export CHANNEL_SECRET=YOUR_CHANNEL_SECRET
$ export CHANNEL_ACCESS_TOKEN=YOUR_CHANNEL_ACCESS_TOKEN

Run

$ node .

Webhook URL

https://your.base.url/callback

Miscellaneous

This is code is mainly modified from the echo bot example here.

About

Find nearest cafes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published