Home

Awesome

Micropython-linenotify

Version License

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.

Installation

Before you receive any messages, you need to install this library on your device.

by choosing one of the following methods:

  1. Manual upload

    • You can install this library by simply uploading linenotify.py to your device.
  2. Package Management in Thonny IDE

    • If you are using the Thonny IDE, you can go to Tools > Manage Packages.
    • At the search bar, simply search for "micropython-linenotify" and install it.

Prerequisite

How to get 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.

Usage

from linenotify import LineNotify
line = LineNotify('<token>')
line.notify('<message>')

Sticker List: https://developers.line.biz/en/docs/messaging-api/sticker-list/

line.notifySticker('<Sticker Package ID>','<Sticker ID>','<Message>')
line.notifyImageURL('<Image URL>','<Message>')

Example Code

# 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')

Reference

https://developers.line.biz/en/docs/messaging-api/sticker-list/

https://notify-bot.line.me/doc/en/