https://github.com/flatfisher/nodejs-rss-notifier
RSS Notifier
https://github.com/flatfisher/nodejs-rss-notifier
cloud-scheduler datastore google google-appengine nodejs
Last synced: 2 months ago
JSON representation
RSS Notifier
- Host: GitHub
- URL: https://github.com/flatfisher/nodejs-rss-notifier
- Owner: flatfisher
- License: mit
- Created: 2018-12-13T12:49:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-27T13:39:43.000Z (about 7 years ago)
- Last Synced: 2024-12-30T22:29:22.786Z (over 1 year ago)
- Topics: cloud-scheduler, datastore, google, google-appengine, nodejs
- Language: JavaScript
- Size: 202 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nodejs-rss-notifier
RSSの内容を取得し更新されていたらLINEに通知するサンプルです
## Warning
これはあくまでサンプルです。リファクタリングや細い認証など行っていないので自己責任でお試しください。
## Prerequirement
- Node.js
- gcloud command
- GCP Account
- LINE Notifyのaccess_token
- https://notify-bot.line.me/doc/ja/
## GCP Products
- Google App Engine 2nd gen Node.js
- Cloud Tasks
- Cloud Scheduler
- Cloud Datastore
## Preparation and deployment
### RSSのURLをDatastoreに登録する
```
$ npm install
```
```
'use strict';
async function saveFeed(url) {
const Datastore = require('@google-cloud/datastore');
const datastore = new Datastore({
projectId: '',
});
const feed = {
key: datastore.key(['Feed']),
data: {
url: url,
date: new Date() //この日時が最終更新日時となる
},
};
return await datastore.save(feed)
}
//GKEのリリースノート
saveFeed("https://cloud.google.com/feeds/kubernetes-engine-release-notes.xml").catch((err) => console.error(err));
```
### app.yamlの編集
```
LINE_AUTHORIZATION: 'LINE Notifyのaccess_tokenを入れる'
```
### Deploy
```
// Cloud Tasksの登録
$ gcloud app deploy queue.yaml
// GAEのデプロイ
$ gcloud app deploy app.yaml --version v1
// Schedulerのセット
$ gcloud beta scheduler jobs create app-engine RSS-Notifier --schedule "0 */3 * * *" --time-zone Asia/Tokyo --description "Notify" --service release-note-notifier --relative-url /v1/tasks/make
```