LINE Notify made it easy to implement LINE notifications, so I made a program that runs on python.
Log in to Line Developer https://notify-bot.line.me/ja/
Go to My Page from the upper right of the screen and issue a token
Invite your LINE Notify account to the selected group
Rewrite the access token and execute the program
python line_notify.py hello
that's all
line_notify.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Use LINE Notify from Python
"""
import urllib
import urllib2
import os,sys
url = "https://notify-api.line.me/api/notify"
message = sys.argv[1]
params = {"message":message}
params = urllib.urlencode(params)
req = urllib2.Request(url)
#Header setting
req.add_header("Authorization","Bearer "+os.environ["LINE_ACCESS_TOKEN"])
#parameter settings
req.add_data(params)
res = urllib2.urlopen(req)
r = res.read()
print(r)
curl -X POST -H'Authorization: Bearer <access token>' -F' message = <message>' https://notify-api.line.me/api/notify
LINE Notify Official
https://notify-bot.line.me/ja/
Official documentation
https://notify-bot.line.me/static/pdf/line-notify-api.pdf
Recommended Posts