Firebase is Google's mobile platform that helps you quickly develop high-quality apps and grow your business.
Go to siteThe Firebase Admin SDK API provides powerful backend functionality for Firebase apps. It allows you to interact with Firebase services like Firestore, Firebase Realtime Database, Firebase Storage, and Firebase Authentication directly from a server. With Pipedream, you can harness this API to automate complex workflows, respond to Firebase events in real-time, and integrate with countless other services.
import admin from "firebase-admin"
export default defineComponent({
props: {
firebase_admin_sdk: {
type: "app",
app: "firebase_admin_sdk",
},
},
async run({ steps, $ }) {
// Enter values for the following parameters below this code step,
// These get passed to the initializeApp method below.
const {
projectId,
clientEmail,
privateKey,
region = "firebaseio.com",
} = this.firebase_admin_sdk.$auth
// Before passing the privateKey to the initializeApp constructor,
// we have to replace newline characters with literal newlines
const formattedPrivateKey = privateKey.replace(/\\n/g, "\n")
// See https://firebase.google.com/docs/reference/admin/node/admin.credential.html#cert
if (!admin.apps.length) {
admin.initializeApp({
credential: admin.credential.cert({
projectId,
clientEmail,
privateKey: formattedPrivateKey,
}),
databaseURL: `https://${projectId}-default-rtdb.${region}/`,
})
}
},
})
User Data Synchronization: Synchronize user profiles in Firestore with user records in a CRM like Salesforce or HubSpot. Whenever a user updates their profile in your app, trigger a Pipedream workflow that updates the corresponding CRM record, ensuring data consistency.
Automated Content Moderation: Implement an automated content moderation flow that triggers whenever new text or images are uploaded to Firebase Storage. Use Google Cloud's Vision API or Perspective API to analyze the content, and if it violates policies, the workflow can automatically remove the content and notify administrators.
Real-Time Analytics Aggregation: When new events are logged in Firebase Analytics, use Pipedream to aggregate this data and send it to a data warehouse like Snowflake or Google BigQuery. This enables advanced analysis and the ability to join this data with other business data sources for comprehensive insights.
Firebase Admin SDK uses API keys for authentication. When you connect your Firebase Admin SDK account, Pipedream securely stores the keys so you can easily authenticate to Firebase Admin SDK APIs in both code and no-code steps.
Enable the Cloud Firestore API on your Firebase account, and make sure you've created at least one collection in the database.
Follow these instructions to generate a private key tied to your Firebase service account. This will generate a JSON file that contains the project ID, private key, and client email that you should paste below.
When entering the private key, please add the full string included in the JSON file, from -----BEGIN PRIVATE KEY-----
to -----END PRIVATE KEY-----
, with all newline characters included.