Firestore - New Document trigger

Updated by Karan

Firestore trigger is required when you want to run a flow after the creation of a new Firestore document. For instance, you have created a new document, and you need to send an email, you can go with Firestore- New Document trigger. 

Byteline allows you to trigger a flow on new Firestore documents using Firestore- New Document trigger. In this documentation, we have explained the steps to configure Firestore - New Document trigger node.

Let’s get started.

Create

In this section, you’ll learn to create a new flow. For more details, you can check How to Create your First Flow Design

Step 1: Enter the flow name to create your new flow.

Step 2: Select the Firestore- New Document trigger node to initiate your flow.

Now, you need to configure the Firestore- New Document trigger to run the flow at a regular interval of time.

So, let’s get started with the Firestore- New Document trigger node configuration.

Configuring Firestore - New Document trigger

Step 1:  Hover the cursor over the Firestore- New Document trigger node icon to display the options. Once displayed, click on the edit button to configure the node.

Step 2: SignIn to your Google Firebase using the credentials.

Step 3: Once signed in successfully, go to the Project settings of your Firebase account to get the project ID.

Step 4: Once Project ID is filled in successfully, select the Firestore database from the drop-down menu.

Step 5: Add Structured Query to get the documents in the right order or in the order they are being created.

Below is an example of the structured query.

{ "structuredQuery":{ "select":{ "fields":[ { "fieldPath":"ID" } ] }, "from":[ { "collectionId":"MyEntity" } ], "orderBy":[ { "field":{ "fieldPath":"ID" }, "direction":"Descending" } ] } }

Step 6: Select the required poll period to set the trigger.

Note: Firestore - new document trigger works by polling for changes. Users need to select the poll period depending upon the frequency of expected data changes.

Step 7: Once selected, click on the Save button to save the changes.

You have successfully configured the Firestore - New Document trigger.

Feel free to connect us with any doubts.


How did we do?