LINE NotifyをNode.jsで使う (シンプル)
notify-bot.line.me
LINE NotifyのAccessTokenの取得が必要です。
const https = require("https") const accessToken = "発行したAccessToken" const options = { hostname: "notify-api.line.me", path: "/api/notify", method: "POST", headers: { "Content-type": "application/x-www-form-urlencoded", "Authorization": `Bearer ${accessToken}` } } const request = https.request(options, res => { res.setEncoding("utf8") res.on("data", console.log) res.on("error", console.log) }) request.write( new URLSearchParams({ message: "メッセージ内容" }).toString() ) request.end()
実行すると
LINEが来ます。