- Python
- MySQL
- Cloudflare
- On your terminal, navigate to the desired workspace and clone the project
git clone git@github.com:docchula/mdcuconnect-lineoa-backend.git- Navigate to project directory
cd mdcuconnect-lineoa-backend- Create a virtual environment for python
python3 -m venv venv- Activate the Environment
source venv/bin/activate- Install dependencies
python3 -m pip install -r requirements_dev.txt- Install pre-commit
pre-commit install- Copy environtment template file
.env-tto.envfile
- Create a new MySQL database
CREATE DATABASE <DB_NAME> CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;- Create a user with password
CREATE USER '<DB_USER>'@'localhost' IDENTIFIED BY '<DB_PASSWORD>';- Grant privileges on the database to your user
GRANT ALL PRIVILEGES ON <DB_NAME>.* TO '<DB_USER>'@'localhost';
FLUSH PRIVILEGES;- Update
.env
DB_NAME=<DB_NAME>
DB_USERNAME=<DB_USER>
DB_PASSWORD=<DB_PASSWORD>
DB_HOST=localhost
DB_PORT=3306-
Go to https://account.line.biz/login and login with your LINE account
-
On the left menu bar, create a new OA
-
After created account, click on
Chattab, it will navigate you toResponse settingspage, then click onMessaging API settingsand click enable. It will ask you to create a new provider -
After created provider, you will see
Channel IDandChannel Secret, update your.envaccording to the values -
Click on
LINE Developers Consoleand select the provider you just created, then create a new Messaging API channel -
In Messaging API channel, click on
Messaging APItab and scroll down to the bottom, you will see theChannel access token -
Click
Issueand copy the token toLINE_CHANNEL_ACCESS_TOKENin.env
- On your terminal, run the backend service
python3 manage.py runserverthe service should run on http://localhost:8000 or http://127.0.0.1:8000
- On another terminal, run
cloudflared tunnel --url http://localhost:8000you should see the quick tunnel url. For example: https://combination-grades-track-thesaurus.trycloudflare.com
-
Copy the quick tunnel url and paste it in LINE OA webhook url, also append
/webhook/callback/at the end of the quick tunnel url. For example: https://combination-grades-track-thesaurus.trycloudflare.com/webhook/callback/ -
At this point, you should be able to interact with the LINE OA
-
Open a new terminal and active the environment
-
Run the following command:
celery -A website worker -l info