I am using Firebase Cloud Function to send FCM upon Real-Time Database Triggered event. How can I get the value of a child ('uid') inside of {followerUid}?
exports.sendFollowerNotification = functions.database.ref('/followers/{followedUid}/{followerUid}').onWrite(event => {
const followerUid = event.params.followerUid;
const followedUid = event.params.followedUid;
I know exactly what you are looking for...
var uid = event.data.val();
var uid1 = String(uid);
add this uid1 to title or body
const payload = {
notification: {
title: paypes
body: uid1
}
};
I'm not sure I understand what you're trying to do but will take a stab.
If you are looking to access the data of uid inside the node that triggered the function:
var uid = event.data.child("uid").val;
Have a look at the documentation on handling event data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With