A simple self promotion LINE bot that helps you promote yourself.
Simply create data.json
under data/
following the example.json
, and see data/README.md for more.
- 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 typedback
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
, thehome
card will be returned
$ git clone https://github.com/andyrochi/self-promo-line-bot.git
$ npm install
$ mv data/example.json data/data.json
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.
$ export NODE_ENV=production
$ export CHANNEL_SECRET=YOUR_CHANNEL_SECRET
$ export CHANNEL_ACCESS_TOKEN=YOUR_CHANNEL_ACCESS_TOKEN
$ node .
https://your.base.url/callback
This is code is mainly modified from the echo bot example here.