A LINE chat bot for querying current weather.
- Python 3
- Django (
Django
) - gunicorn (
gunicorn
) - SDK for LINE Messaging API (
line-bot-api
) - SDK for Google api.ai (
apiai
)
- Django (
-
Setup secret information
There are two ways to reach it.
- Using environment variables
export SECRET_KEY='SECRET_KEY' export CWB_AUTHED_KEY='CWB_AUTHED_KEY' export LINE_CHANNEL_SECRET='LINE_CHANNEL_SECRET' export LINE_CHANNEL_ACCESS_TOKEN='LINE_CHANNEL_ACCESS_TOKEN' export API_AI_CLIENT_ACCESS_TOKEN='API_AI_CLIENT_ACCESS_TOKEN'
- Write secret to
weather_bot/secret.py
SECRET_KEY = 'SECRET_KEY' CWB_AUTHED_KEY = 'CWB_AUTHED_KEY' LINE_CHANNEL_SECRET = 'LINE_CHANNEL_SECRET' LINE_CHANNEL_ACCESS_TOKEN = 'LINE_CHANNEL_ACCESS_TOKEN' API_AI_CLIENT_ACCESS_TOKEN = 'API_AI_CLIENT_ACCESS_TOKEN'
-
Modify
ALLOWED_HOSTS
inweather_bot/settings.py
ALLOWED_HOSTS = [ 'YOUR_HOST' ]
-
Deploy this web application in HTTPS server
You may use Heroku to help you get HTTPS URL.
-
Go to LINE Bot setting page
Fill callback url for bot in
Webhook URL
field.(e.g.
https://YOUR_HOST/service/callback/
)