Skip to content

Instantly share code, notes, and snippets.

View shinoda-ak's full-sized avatar
🏠
Working from home

Hirohito Shinoda shinoda-ak

🏠
Working from home
  • AsahiKASEI
  • Tokyo
View GitHub Profile
// Node.js on RPI3
'use strict';
const request = require('superagent');
const FCM_URL = 'https://fcm.googleapis.com/fcm/send';
const FCM_SERVER_KEY = 'YOUR_FCM_SERVER_KEY';
const MSG_TITLE = 'fcm-https.js';
if (process.argv.length < 3) {
console.log('Usage: node fcm-https.js FIREBASE_INSTANCE_ID_TOKEN [MESSAGE]');
process.exit();
@shinoda-ak
shinoda-ak / notify-awssns2fcm.js
Created May 1, 2017 08:32
Notify FCM for Android via AWS SNS
// Notify Target ARN for Android device
'use strict';
const AWS = require('aws-sdk');
const sns = new AWS.SNS({
apiVersion: '2010-03-31',
region: 'MY_REGION'
});
if (process.argv.length < 3) {
console.log('Usage: node notify.js ENDPOINT_ARN');
process.exit();
@shinoda-ak
shinoda-ak / aws-sns-add-endpoint.js
Created May 1, 2017 08:28
Firebase Instance ID token to AWS SNS target ARN
// Firebase Instance ID token to SNS target ARN
'use strict';
const AWS = require('aws-sdk');
const sns = new AWS.SNS({
apiVersion: '2010-03-31',
region: 'MY_SNS_REGION'
});
if (process.argv.length < 3) {
console.log('Usage: node add-endpoint.js FIREBASE_INSTACE_ID_TOKEN');
process.exit();