A Line bot based on a finite state machine for TOC Project 2021
Github repository: https://github.com/Eddielin0926/FSM-Line-Bot
- Conda (Anaconda/Miniconda)
- Create Conda environment
$ conda create --name toc python=3.6
$ conda activate toc
- Install pygraphviz
(toc) $ conda install -c conda-forge pygraphviz
- Install other dependencies
(toc) pip install python-dotenv pygraphviz transitions line-bot-sdk flask colorama
- Creat
.env
file and fill in your channel info
LINE_CHANNEL_SECRET=<your_line_channel_secret>
LINE_CHANNEL_ACCESS_TOKEN=<your_line_channel_access_token>
PORT=8000
- Download Ngrok and execute
ngrok http 8000
- Update webhook url Concate the url generate by Ngrok with /webhook (/callback) and put it to line bot channel
- Start Conda environment
$ conda activate toc
- Execute program
(toc) $ python app.py
Deploy the Line-bot server on Heroku.
-
Register Heroku: https://signup.heroku.com
-
Create Heroku project from website
-
CLI Login
$ heroku login
- Setup environment variables
heroku config:set LINE_CHANNEL_SECRET=<your_line_channel_secret>
heroku config:set LINE_CHANNEL_ACCESS_TOKEN=<your_line_channel_access_token>
- Fix
pygraphviz
intall error
heroku buildpacks:set heroku/python
heroku buildpacks:add --index 1 heroku-community/apt
- url:
{HEROKU_APP_NAME}.herokuapp.com/callback
- logs:
heroku logs --tail --app {HEROKU_APP_NAME}
- TOC-Project-2020
- Pipenv ❤️ @chihsuan
- TOC-Project-2019 ❤️ @winonecheng
- Flask Architecture ❤️ @Sirius207
- Line line-bot-sdk-python
- More details in the Slides and FAQ