This is a project I made to help my community get a daily devotion everyday. If there are any questions regarding LINE API, feel free to contact me at Instagram: @kens.vin 😊.
Explanation about the web scraping technique in this project
Quick reference for Line Chatbot
Line API Documentation for Python
In the Channels tab of the provider page you created, click Create a Messaging API channel. Enter the required information for your channel. "LINE" or a similar string can't be included in the channel name.
You can clone this repository, get a simple Python bot template from Abhista Gatya, or use your own code.
If you're still new to Github, you can find out how to clone a Github repository here.
Select a Messaging API channel from the Channels in the LINE Developers Console and issue the channel secret from the basic settings tab. Select the Messaging API tab and issue a long-lived channel access token.
Copy them from the LINE Developers Console and paste them in the designated variables.
You can use Heroku to deploy the app because it lets us to host our app for free up to 550 dyno hours per month.
Create a free Heroku account here
Download the Heroku CLI and follow the installation instructions here More CLI reference: Heroku Command Line
Login to your account in Heroku CLI using your terminal (Windows Terminal/Command Prompt/Terminal)
heroku login
Move to the directory where you cloned/downloaded your app in the CLI using the cd
command and create the app using this code
cd .\Downloads\linechatbot
git commit -a -m "Any message"
heroku create [YOUR-APP-NAME]
git push heroku master
Once the deploy is successful, open up your Heroku dashboard in your web browser and click 'Open app'.
Don't worry if the page looks like this:
Add callback
to the end of the URL so that it will look like this: https://yourbotname.herokuapp.com/callback
and copy the URL.
Open your LINE Developers Console, select the Messaging API tab and click Edit under Webhook URL, paste the URL, and then click Update. Additionally, enable Use webhook.
Add the LINE Official Account associated with the channel for your bot as a friend on LINE. To do so, scan the QR code on the Messaging API tab in the LINE Developers Console.
12. Register your app in Kaffeine (Optional)
Kaffeine lets our app which is hosted in Heroku to become active up to 18 hours a day by pinging them every 30 minutes. You can set your app's active time according to your preference. By using their service, the deployed bot in Heroku can send automated messages at a certain time daily.