I am trying to send notifications to user those who subscribed to a topic.. The notifications are working fine but notification title shows 'undefined' and there is no image as well.
This is my code.
const functions = require('firebase-functions');
const admin=require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.sendNotifications = functions.database.ref('All_Events/{pushId}')
.onWrite(event => {
const mydata=event.after.val();
var topic='updates';
var message={
data:{
title: String(mydata.title),
content: String(mydata.desc),
url: String(mydata.image)
},
topic:topic
};
console.log('posted succesfully');
console.log('title = ',mydata.title);
return admin.messaging().send(message)
});
My Database Layout:

How do I get a reference to CSE, ECE, etc. from the database?