https://github.com/siriyas/linebot-covid
LINE messaging api with Flask
https://github.com/siriyas/linebot-covid
flask heroku linebot
Last synced: 3 months ago
JSON representation
LINE messaging api with Flask
- Host: GitHub
- URL: https://github.com/siriyas/linebot-covid
- Owner: SiriyaS
- Created: 2020-04-03T11:24:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-20T10:44:09.000Z (about 6 years ago)
- Last Synced: 2025-03-04T23:13:11.093Z (over 1 year ago)
- Topics: flask, heroku, linebot
- Language: Python
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# linebot-covid
LINE messaging api with Flask
### linebot COVID-19 Tracker (only infection in Thailand)
## Setting Line Official Account
create your line messaging API in https://developers.line.me/
※ set **Auto-reply messages** to **Disable**
※ also **Enabled webhook**
※ copy your **Channel secret** and **Channel access token**
Ready to implement your code!
## Implement Line API
※ clone this repository
```
git clone https://github.com/SiriyaS/linebot-covid.git
```
cd to the project
※ set up virtual environment (if you don't have, install by `pip install virtualenv` first)
```
virtualenv -p python3 venv
```
※ activate the virtual environment
```
source venv/bin/activate
```
you can deactivate the virtual environment by type `deactivate` in terminal
※ install all dependencies in project
```
pip install -r requirements.txt
```
※ change **Channel secret** and **Channel access token** to yours
It's time to implement your line API logic!
※ the **logic** for linebot to answer the chat is in `function handle_message`
※ the **text messeage** from the chat room is `event.message.text` variable
※ this line is how your linebot gonna answer (`reply_message` is the message your bot gonna answer)
```
line_bot_api.reply_message(
event.reply_token,
reply_message)
```
※ when you finish implementing the code **push** your work to your own **GitHub**
Next we gonna deploy our work to Heroku
## Deploy your code to Heroku
sign in to Heroku https://id.heroku.com/login and **create new app**
※ for **Deployment Method** select **GitHub**
※ select **GitHub repository** and **branch** you want to connect with
※ for **Automatic Deploys** click **Enable Automatic Deploys** (if you want to deploy your work automatically whenever you push to GitHub)
※ (optional) for **Manual Deploy** click **Deploy branch**
Now, Let's connect Webhook to your linebot
## Add Webhook URL to your channel
Back to LINE Developer
In **Messaging API** tab goes down to **Webhook Setting**
※ add webhook URL ex. `https://.herokuapp.com/webhook`
※ click **Verify**, you should see **Success** pop-up window
##
🎉 Congratulation! Now your LINE bot is ready.
Add friend and start chatting.