Created
January 16, 2019 19:48
-
-
Save Widcket/d2302171a8588f1382979b777752cdfd to your computer and use it in GitHub Desktop.
Remote Config Cloud Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
| |
admin.initializeApp(functions.config().firebase); | |
| |
exports.pushConfig = functions.remoteConfig.onUpdate(metadata => { | |
const payload = { | |
data: { | |
CONFIG_STATE: 'STALE' | |
} | |
}; | |
| |
const options = { | |
content_available: true | |
}; | |
| |
// Use the Admin SDK to send the ping via FCM. | |
return admin | |
.messaging() | |
.sendToTopic('REMOTE_CONFIG', payload, options) | |
.then(response => { | |
console.log(response); | |
return null; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment