Firebase / Firestore

Firebase / Firestore Help & Support

What Firebase Triggers, Actions, and Searches are Supported?

Supported Triggers#

  • New Child Object in a Firebase Realtime Database - Triggers when a new child object is discovered within a specific path.
  • New Document Within a Firestore Collection - Triggers when a Structured Query returns new documents within a Cloud Firestore collection.

Supported Actions#

  • Create or Replace Firebase Realtime Database Record - Creates or replaces a child object within your Firebase Realtime Database.
  • Create Cloud Firestore Document - Creates a new document within a Cloud Firestore collection.

Supported Searches#

  • Find Firebase Realtime Database Record - Finds a child object using a custom query that you provide.
  • Find Cloud Firestore Document - Finds a document using a Structured Query within a collection.
Was this content helpful?

How to Get Started with Firebase

About Firebase's Integration#

Connecting with Firebase#

To get started with Firebase on Zapier, first you will need to connect your Firebase project/account with your Zap

select account

Next, you'll be asked to enter the Project's ID:

config account

To find your Project's ID, please follow these steps:

  1. Visit your Firebase/Firestore Cloud Console: https://console.firebase.google.com
  2. Copy the Project's ID, which is the line of text below the project's name

Google will verify that you want to give permission for the integration to access the project:

If you have entered your details correctly, you will be successfully connected.

Was this content helpful?

Common Problems with Firebase

Creating a Firestore Structured Query for a Trigger#

When using a Zap to trigger on new documents within a Firestore collection, it's important to build a Structured Query that returns the selected documents in the correct order, otherwise your Zap may never see the new documents.

The orderBy property in your query needs to ensure that the new documents are at the "top" of the search results, so that the Zap can see those documents. In most cases, you'll want to use DESCENDING, like this:

    "orderBy": [{
        "field": {
            "fieldPath": "someKeyOfYourChoice"
        },
        "direction": "DESCENDING"
    }]

If your field has spaces in it, you will need to surround it with backticks. For example:

    "orderBy": [{
        "field": {
            "fieldPath": "`a field with spaces`"
        },
        "direction": "DESCENDING"
    }]

You can learn more about the correct syntax/structure here: https://cloud.google.com/firestore/docs/reference/rest/v1beta1/StructuredQuery#Order

Creating a Firestore Structured Query for a Search#

When using a Zap to search for a specific document within a Firestore collection, it's important to build a Structured Query that contains the appropriate where clause, like this:

    "where": {
        "fieldFilter": {
            "field": {
                "fieldPath": "whenPlayed"
            },
            "op": "EQUAL",
            "value": {
                "stringValue": "some-compare-to-value"
            }
        }
    }

In your Zap, the "compare to" value is probably something that you'll want to connect with a previous step within your Zap, using the "plus" button on the right-hand side of the input field within the Zap Editor.

You can learn more about the correct syntax/structure here: https://cloud.google.com/firestore/docs/reference/rest/v1beta1/StructuredQuery#Filter

Invalid data error (Couldn't parse JSON object)#

Sometimes you will see an error that says "Invalid data; couldn't parse JSON object, array, or value. Perhaps you're using invalid characters in your key names."

This error occurs when the fields you are trying to send to Firebase contain invalid characters. Firebase prohibits key names from containing:

  • . (period)
  • $ (dollar sign)
  • [ (left square bracket)
  • ] (right square bracket)
  • # (hash or pound sign)
  • / (forward slash)

To get around the error, you will need to manually assign names to the keys. See the Customizing Fields to Store section for details.

My Firebase Zap isn't triggering when I add new records#

New records need to appear at the end of your data for this to work. If you aren't using push IDs, your records need to be ordered lexicographically or by priority so that new records appear last.

A simple way to accomplish this is by calling setWithPriority and using Firebase.ServerValue.TIMESTAMP to order by timestamp.

Error: Empty key in "Path to data". Probably tried to use a field which was empty as part of the path#

Make sure you remove the beginning and ending / from the Path field.

For example, /customers/new/ becomes customers/new.

I'm getting "Firebase paths/keys cannot contain the characters $ # . [ ]" but there are no invalid characters included in the path/keys#

Users sometimes encounter this error if anything that is being supplied in the value has a pipe ( | ) character in it. For example:

pipe in value

This has to due with the way our system encodes key/value pairs. The recommend solution is to not include invalid characters in the value that is included or use a Formatter step to remove the characters.

Was this content helpful?

Need More Help? - Our support team is happy to help -- send us a message

Firebase Realtime Database and Google Cloud Firestore are flexible databases that give you the ability to easily store and sync app data at global scale.

Learn More

Getting Started with Zapier

Need more help? Try the Zapier Help Center