Skip to content

Instantly share code, notes, and snippets.

@vladfatu
vladfatu / Send transactional push notifications from a Firebase Cloud Function.js
Last active November 16, 2020 22:16
Send transactional push notifications from a Firebase Cloud Function
function sendPush(uid) {
// Get the user from Firestore
const getDeviceTokensPromise = admin.firestore()
.collection('users').doc(uid).get();
// Get the User profile from Firebase Auth
const getUserProfilePromise = admin.auth().getUser(uid);
Promise.all([getDeviceTokensPromise, getUserProfilePromise])