- Create a new Line Messaging API Channel.
- Fork this repository.
- On your repo,
- Deploy to Heroku
- Set Config Vars
- access_token: Channel access token
- channel_secret: Channel secret
- Deploy app
- Back to Line Channel settings,
- Enable webhook
- Set Webhook URL to
https://your_heroku_app_url/webhook
and verify.
- In Line Official Account Manager,
- Enable Webhook
server.py
from linebot import simple_bot
SB = simple_bot()
@SB.webhook
def webhook():
pass
There are two methods: regex
, kwywd
Regular expression and keywords.
And support three types of message: text
, sticker
, image
- text
- packageId
- stickerId
You can find packageId
and stickerId
in sticker list.
- originalContentUrl
- previewImageUrl
You can find examples in reply.cfg
.
SB.regex(regex_str)(reply_func)
SB.keywds(kwywds_list)(reply_func)
Each reply_func
should return a msg_dict
.
The keys and values in msg_dict
are the same as in reply.cfg
.
You can find examples in server.py
.