Skip to content

Kensvin28/linechatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 Developers

Messaging API reference

Line API Documentation for Python

Steps to launch your LINE chatbot:

image

image

3. Create a new provider:

image image

4. Create a channel

In the Channels tab of the provider page you created, click Create a Messaging API channel. image Enter the required information for your channel. "LINE" or a similar string can't be included in the channel name. image

5. Create your own bot or use a template

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.

6. Obtain your channel secret and channel access token

Select a Messaging API channel from the Channels in the LINE Developers Console and issue the channel secret from the basic settings tab. Channel Secret Select the Messaging API tab and issue a long-lived channel access token. Channel Access

7. Put your channel secret and channel access token into your app

Copy them from the LINE Developers Console and paste them in the designated variables. image

Deploy app to a server

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.

8. Create a Heroku Account and Download the Heroku CLI

Create a free Heroku account here image

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

10. Configure the Webhook

Once the deploy is successful, open up your Heroku dashboard in your web browser and click 'Open app'. image

Don't worry if the page looks like this: image

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.

image

11. Add your LINE bot as a new friend by using the QR code

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. image

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. image

Releases

No releases published

Packages

No packages published

Languages