alipbudiman / usage-example-of-LINE-NOTIFY

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

notify-bot

Line Notify:

Receive web service notifications on LINE

Get notifications from LINE Notify's official account after connecting with your preferred web services. You can receive notifications from multiple services in groups or 1-on-1 chats.

First you must get a token from notify

ntf1

First, login into https://notify-bot.line.me/en/ tap log in, and login with your email and password

ntf2 Tap your name on the top right of the screen.

ntf3

Tap my page

ntf4

scroll down, and press generate token

ntf5

You can free to named the token and chosee your notification send to

ntf6

here I choose the message sent directly to me

ntf7

you will get a token, and copy the token then paste it into the script

And this is result:

ntf8

for mor information: https://notify-bot.line.me/doc/en/

LETS CODE!!

#SIMPEL USING LINE NOTIFY

import requests, schedule, time
"""
simpel using line notify methoe
"""
def sendtoNotify():
token = "oWREJ7eRWI7CQscwvPalLZrcu4klQ5R0MXFJwSDCdm5"
content = "Take a bath, take a bed again"
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": f"Bearer {token}",
}
url = "https://notify-api.line.me/api/notify"
message = f"\n{content}"
r = requests.post(url=url, headers=headers, data={"message": message})
print(r.text)
schedule.every().day.at("06:00").do(sendtoNotify)
while True:
schedule.run_pending()
time.sleep(1)

#ACCESS LINE NOTIFY

from NotifyFunction import *
alip = LINE_Notify(
"33TquxG38gVmboJSFKFWelxMarW6AZsp7mGvhng5Qzz" #<< imput your own notify token here
)

#SEND MESSAGE

alip.sendMessage("Hello World") #<< send message

#UPLOAD AND SEND IMAGE

alip.sendImage("tmpIMG/FXG (1).png") #<< send image

#SEND STICKERS

alip.sendSticker(6325,10979904) #<< send sticker

#CEK API STATUS

alip.cekApiStatus( #<< cek Notify api status
"33TquxG38gVmboJSFKFWelxMarW6AZsp7mGvhng5Qzz"#<< imput your notify token want to cek
)

#REVOKING NOTIFY TOKEN

alip.revokeToken( #<< revoke notify token
"fEwMDBwFfTYPj5ftsBoblxkxc94tgPEfgYZEVRgPSWp" #<< imput your notify token want to revoke
)

#EXAMPLE BOT GREETINGS & ADZAN https://github.com/alipbudiman/usage-example-of-LINE-NOTIFY/blob/main/LINE%40%20Notify.py

About


Languages

Language:Python 100.0%