Firebase Message

firebase

(Adedamola Rioland) #1

i am try to create a simple chat app in android and i want to add firebase notification
i created a general chat room that all user can chat together, so i wanted to add firebase puch notification so if any one send message to that room every one will see it but i learn that i need to use firebase function and i have used it but the message is not sending ,so i need help


(Adedamola Rioland) #2
'use strict'
const functions = require('firebase-functions');

const admin = require('firebase-admin');

admin.initializeApp(functions.config().firebase);

exports.sendNoti = functions.database.ref('/publicgroup')
.onWrite(event => {

const head='Notificatios';
const payload={

notification:{
title: "New message",
body: "You got a message from Public Group",
icon: "default"

}

};

return admin.messaging().sendToTopic(head,payload).then(response => {
console.log('Message Log sent is ok');

});

});

(Varun Raj) #3

Hello @Adedamola_Rioland,

Have you able to check in the firebase fcm admin dashboard if the trigger notifications have the corresponding status?