Firebase Database Action
Last updated
Last updated
Use this action to insert, update, delete or retrieve one or more Firebase cloud documents from your Firebase account.
The action uses the following settings:
Setting | Description | |
Firebase Account JSON | The JSON account token that you can retrieve from your Firebase account. | |
Action | The type of action you want to execute on the database. | |
Project Id | The project id of your database. | |
Database Name | The name of your database. If you have only one database, you can leave (default) as name. | |
Collection Name | The name of the database collection you want to target with your command. | |
Document Id | The Id of the document you want to target with your action. | |
Document Payload | The full JSON payload of your document. | |
Structured Query Filter | The full structured query payload | |
JSON Token Path | The JSON path of the data you want to extract for the Firebase reply. | |
Target Variable | The name of the variable that will hold the result of the action executed. |
When requesting or uploading a full Firebase document, Xenioo will automatically translate each model into a simpler representation that will both speed up parsing and simplify representation.
As an example, let's have a look at the following Firebase Firebase document:
As you can see it's very complete, but also quite verbose and not very handy for quick variables reading. When accessing this document, Xenioo will automatically shrink the structure to a more concise version:
Note two things: first, the document id has been reduced to represent only the actual document final unique value. Second, the age field has been automatically translated in the projected model to the correct type, representing a number.
The same translation happens also in reverse. When using the second model to update a Firebase document, Xenioo will transform back the model to the Firebase format. Note that this is not mandatory: the Firebase Action supports both the default, Firebase native format and the Xenioo translated one.
When using QUERY mode, a full structured query can be specified inside the Query Payload parameter. As an example, searching for a document where the field "FirstName" is equal to "Mary" would require a query like this:
All of the actions that can be executed by this action can also be executed directly by code, using specific methods available in Xenioo Cloud Scripting Action.
To avoid overload, when no filter is active, the action will not query all the records available in a given collection. Only the first 20 fields will be extracted. Do not use the LIST mode to access the full list of records and then search manually. Use a structure
This action does not trigger any event.
Beside the value set to the selected Target Variable setting, this action is producing the following variables:
Variable | Description |
firebase_list_empty | Set to true if the last command returned an empty list or false if any record was found |
firebase_last_document_id | Contains the last document id returned by an UPDATE or CREATE database command |
Channel specific availability follows the table below:
Channel | Availability |
Fully Available. | |
Fully Available. | |
Telegram | Fully Available. |
Web | Fully Available. |
Alexa | Fully Available. |
Google Assistant | Fully Available. |
Slack | Fully Available. |
API | Fully Available. |
This action can be used only inside interactions and not as child of other actions. This action requires a Premium Account to be used on a live chatbot.