Help us understand the problem. What is going on with this article?

PythonでLINEに通知を送る

More than 3 years have passed since last update.

バッチなどで日々のKPIを自動で集計した内容をすぐ確認できるようにしてみる。今回はLINEへ通知する方法。とても簡単

1.まずは下記にアクセスし、ログインした上で通知を行いたいチャットに対してアクセストークンの発行を行う。

https://notify-bot.line.me/ja/

image

2.発行されたアクセストークンをメモして(1回しか表示されないらしいので注意。コピーし忘れたら一旦提携を解除してもう一度発行しなおせばOK)

3.以下のコードを追加

import requests

line_notify_token = 'アクセストークン'
line_notify_api = 'https://notify-api.line.me/api/notify'
message = '通知したい内容'


payload = {'message': message}
headers = {'Authorization': 'Bearer ' + line_notify_token}  # 発行したトークン
line_notify = requests.post(line_notify_api, data=payload, headers=headers)

analytics-hiro
都内のIT系の会社で分析や機械学習のお仕事してます。 趣味で開発などもやってます。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした