blob: 4a49705a457c0a321c686714647dacb1853d9472 [file] [log] [blame] [edit]
/**
* Background Cloud Function to be triggered by Pub/Sub.
*
* @param {object} event The Cloud Functions event.
* @param {function} callback The callback function.
*/
exports.helloPubSub = function (event, callback) {
const pubsubMessage = event.data;
const name = pubsubMessage.data ? Buffer.from(pubsubMessage.data, 'base64').toString() : 'World';
console.log(`Hello, ${name}!`);
callback();
};