Skip to content

nikkothari22/firebase-logsnag-extension

Repository files navigation

Firebase LogSnag Extension (Unofficial)

Install the extension using this link

Author: Nikhil Kothari (https://github.com/nikkothari22)

Description: Functions to send events and insights to LogSnag. (Not an official extension)

This is not an official Logsnag extension and the author is not associated with LogSnag or Firebase in any manner whatsoever. All trademarks and copyrights belong to the respective companies.

Details: Use this extension to publish events and insights to your LogSnag channel. The extension uses the official LogSnag Node.js library.

You need to have a LogSnag account and get the authentication (Access) token and the project name (refer to the LogSnag documentation for this). When you need to publish an event or insight, simply create a new document in Firestore.

The extension has a cloud function that's triggered whenever a new document is created in the collections specified during installation.

Here's a basic example document write that would trigger this extension to publish an event in LogSnag:

admin.firestore().collection('logsnagEvents').add({
    channel: "waitlist",
    event: "User Joined",
    description: "Email: [email protected]",
    icon: "🎉",
    tags: {
      name: "john doe",
      email: "[email protected]",
    },
    notify: true
})

To publish an insight, you would need to write a document in another collection:

admin.firestore().collection('logsnagInsights').add({
    title: "User Count",
    value: "100",
    icon: "👨"
})

Additional setup

Before installing this extension, make sure that you've set up a Cloud Firestore database in your Firebase project.

Billing

To install an extension, your project must be on the Blaze (pay as you go) plan

  • You will be charged a small amount (typically around $0.01/month) for the Firebase resources required by this extension (even if it is not used).
  • This extension uses other Firebase and Google Cloud Platform services, which have associated charges if you exceed the service’s free tier:
    • Cloud Firestore
    • Cloud Functions (Node.js 16 runtime. See FAQs)

Cloud Functions:

  • processEvent: Runs when a document is created in the specified Cloud Firestore collection for events, publishes the event in LogSnag, and updates the document with delivery status information.

  • processInsight: Runs when a document is created in the specified Cloud Firestore collection for insights, publishes the insight in LogSnag, and updates the document with delivery status information.

Access Required:

This extension will operate with the following project IAM roles:

  • datastore.user (Reason: Allows this extension to access Cloud Firestore to read and process added email documents.)

Configuration Parameters:

  • Cloud Functions location: Where do you want to deploy the functions created for this extension? You usually want a location close to your customers. For help selecting a location, refer to the location selection guide.

  • Events Collection path: The path to the collection where documents will be created to publish events in LogSnag.

  • Insights Collection path: The path to the collection where documents will be created to publish insights in LogSnag.

About

Firebase extension to send events and insights to LogSnag

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published