LINE Notify是一項非常方便的服務,用戶可以透過LINE接收GitHub、IFTTT及Mackerel等網站服務的提醒。
透過LINE接收其他網站服務通知
與網站服務連動完成後,LINE所提供的官方帳號「LINE Notify」將會傳送通知。
不僅可與多個服務連動,也可透過LINE群組接收通知。
Line Notify運作方式:
- 註冊Line Notify。
- 新增一個Provider,填寫表單資料與設定
Redirect_uri。 - 取得
client_id和client_secret,換取code。 - 使用
code和client_id和client_secret換account_token。 Authorization:
Bearer <access_token>,就可以發訊息了。
1.取得code
The following is the OAuth2 authorization endpoint URI.1
GET https: //notify-bot.line.me/oauth/authorize
Request: response_type, client_id, redirect_uri, scope, state, response_mode
Response(success): code, state
Response(failure): error, state, error_description
2.取得account_token
The OAuth2 token endpoint.1
POST https://notify-bot.line.me/oauth/token
Request: grant_type, code, redirect_url, client_id, client_secret
Response: Status, Content-Type(application/json)
Response body(JSON): access_token
3.發送訊息、貼圖、圖片
Sends notifications to users or groups that are related to an access token.1
POST https://notify-api.line.me/api/notify
Request method: Authorization Bearer <access_token>
Request: message, (imageThumbnail), (imageFullsize), (imageFile), (stickerPackageId), (stickerId)
Response: Status, Content-Type(application/json)
Response body(JSON): status, message
4.確認Line Notify連結狀態狀態
An API for checking connection status.1
GET https://notify-api.line.me/api/status
Request method: Authorization Bearer <access_token>
Request: message, (imageThumbnail), (imageFullsize), (imageFile), (stickerPackageId), (stickerId)
Response: status, Content-Type(application/json)
Response body(JSON): status, message, targetType, target
5.撤消Line Notify
An API used on the connected service side to revoke notification configurations.1
POST https://notify-api.line.me/api/revoke
Request method: Authorization Bearer <access_token>
Request: message, (imageThumbnail), (imageFullsize), (imageFile), (stickerPackageId), (stickerId)
Response: status, Content-Type(application/json)
Response body(JSON): status, message