How to use the firebase-function-tools/lib/notifications.notifyUser function in firebase-function-tools

To help you get started, we’ve selected a few firebase-function-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TarikHuber / react-most-wanted / packages / cra-template-rmw / template / functions / db / userChatMessages / onCreate.f.js View on Github external
let notifyUser = null

      if (snapValues.authorUid !== receiverUid) {
        const payload = {
          notification: {
            title: `${snapValues.authorName} `,
            body: lastMessage,
            icon: snapValues.authorPhotoUrl
              ? snapValues.authorPhotoUrl
              : '/apple-touch-icon.png',
            click_action: `https://www.react-most-wanted.com/chats/edit/${senderUid}`,
            tag: `chat`,
          },
        }

        notifyUser = notifications.notifyUser(receiverUid, payload).then(() => {
          return senderChatMessageRef
            .update({
              isReceived: context.timestamp,
            })
            .then(() => {
              return senderChatRef.update({
                isReceived: context.timestamp,
              })
            })
        })
      }

      return Promise.all([
        udateReceiverChatMessage,
        udateSenderChat,
        udateReceiverChat,

firebase-function-tools

firebase-function-tools

MIT
Latest version published 4 years ago

Package Health Score

60 / 100
Full package analysis