It is a MicroPython library for sending notifications to Line Notify,which can be used with ESP8266 and ESP32.
Can send both text messages, stickers and images.
Before you receive any messages, you need to install this library on your device.
by choosing one of the following methods:
-
Manual upload
- You can install this library by simply uploading linenotify.py to your device.
-
Package Management in Thonny IDE
- ESP32/ESP8266 with MicroPython installed and can connect to the internet
- Line Notify Token
Login at https://notify-bot.line.me/en/.
At the top-right dropdown menu, select my page .
Scroll down the browser window to find Generate Token.
Enter your Notify Name then select chat or group.
Click Generate Token, and the token will be generated.
- Import Library
from linenotify import LineNotify
- Create Instance and set token
line = LineNotify('<token>')
- Notify text message
line.notify('<message>')
- Notify sticker with text message
Sticker List: https://developers.line.biz/en/docs/messaging-api/sticker-list/
line.notifySticker('<Sticker Package ID>','<Sticker ID>','<Message>')
- Notify image from URL with text message
line.notifyImageURL('<Image URL>','<Message>')
# Import Library
from linenotify import LineNotify
from network import WLAN,STA_IF
# Network Setup
ssid = '<ssid>'
password = '<password>'
wlan = WLAN(STA_IF)
wlan.active(True)
print('Connecting...')
wlan.connect(ssid,password)
while not wlan.isconnected():
pass
print(wlan.ifconfig())
# Set Line Token
line = LineNotify('<token>')
# Notify text message
line.notify('Hello World!')
# Notify sticker with message
line.notifySticker(3,240,'Nice Sticker')
# Notify image from URL with message
line.notifyImageURL('https://static.wikia.nocookie.net/chainsaw-man/images/1/1b/Pochita.PNG','Pochita')
https://developers.line.biz/en/docs/messaging-api/sticker-list/