close

 

A weather Line provider is created, and then click "Create a LINE login channel"

In <Channel icon> I choose a basketball that I downloaded on the internet

Choose <Messaging API> in channel type comboBox

 

In <Channel name>, I named it as "weatherman"

In <Channel description>: It helps you look up today's weather in Taiwan

In <Category>: 生活相關服務

In <Subcategory>: 生活相關服務(其他)

When you finished the "Basic Settings", you'll see the following stuff.

 

Then I'm gonna set up "Messaging API"

Turn off both "Auto-reply messages" and "Greeting messages" by clicking the "Edit" buttons on their right-hand sides.

 Before you started to develop the backend program, don't forget to copy the values of the

channel secret and channel access token which will be used later

 -----------------------------------------------------------------------------------------

Start to install LINE Bot SDK

> pip install line-bot-sdk

Downloading line_bot_sdk-1.20.0-py2.py3-none-any.whl (72 kB)
|████████████████████████████████| 72 kB 1.1 MB/s
Requirement already satisfied: requests>=2.0 in c:\users\fusun\anaconda3\envs\opencv440\lib\site-packages (from line-bot-sdk) (2.25.1)
Requirement already satisfied: future in c:\users\fusun\anaconda3\envs\opencv440\lib\site-packages (from line-bot-sdk) (0.18.2)
Requirement already satisfied: idna<3,>=2.5 in c:\users\fusun\anaconda3\envs\opencv440\lib\site-packages (from requests>=2.0->line-bot-sdk) (2.10)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\fusun\anaconda3\envs\opencv440\lib\site-packages (from requests>=2.0->line-bot-sdk) (4.0.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\fusun\anaconda3\envs\opencv440\lib\site-packages (from requests>=2.0->line-bot-sdk) (1.26.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\fusun\anaconda3\envs\opencv440\lib\site-packages (from requests>=2.0->line-bot-sdk) (2021.5.30)
Installing collected packages: line-bot-sdk
Successfully installed line-bot-sdk-1.20.0

 

Install ngrok  and write a simple batch file

 

Then don't forget to modify the webhook settings in your LINE Bot channel

Go to Messaging API >> Webhook Settings  >> Edit

You also have to run your own lineBotTest.py. The program, a flask server, processes all the events delivered by the Line Bot

Here is an example of the dictionary.  The weather LINE Bot responds with a link when the user inputs a new word and it also pushes a count-down number immediately.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

arrow
arrow
    全站熱搜

    me1237guy 發表在 痞客邦 留言(0) 人氣()