Name, Service, Conditions, Event Handler
Name:makeUppercase, Realtime Database, Trigger on specific path, makeUppercase handler
const functions = require('firebase-functions'); exports.emojify = functions.database.ref('/messages/{pushId}/text') .onWrite(event => { if(!event.data.val()|| event.data.previous.val()){ console.log("not a new write event"); return; } console.log("emojifying"); const originalText = event.data.val(); const emojifiedText = emojifyText(originalText); return event.data.ref.set(emojifiedText); }); function emojifyText(text){ var emojifiedText = text; emojifiedText = emojifiedText.replace(/\blob\b/id, ""); emojifiedText = emojifiedText.replace(/\blob\b/id, ""); return emojifiedText; }