In this article you'll learn how to display data from a PostgreSQL database in a Dixa conversation using the no-code/low-code tool FactBranch. By creating a custom card in Dixa and connecting it to FactBranch, we can load additional information from our database and display it seamlessly within the conversation. There's also a step-by-step video guide accompanying this article, in which we set up everything in 6 minutes:
If you haven't done so already, create a FactBranch account: Visit factbranch.com and start your 14-day free trial. Once you've signed up for FactBranch, you'll be prompted to create your first Flow.
Flows in FactBranch are data pipelines that are triggered by specific events. In this case, the trigger will be a custom card in Dixa. Create a flow of type "Show data in a Dixa custom card". The flow will progress through various nodes, with the final node being a node that generates a graphical user interface (GUI) and displays the data. However, before we can display the data, we need to load it from our PostgreSQL database.
To load data from the database, create a PostgreSQL node in FactBranch. Create a node, select the PostgreSQL option and proceed to enter your PostgreSQL credentials.
We recommend to create a special database user for FactBranch that has as few permissions as possible.
If your database runs behind a firewall, you may need to activate the option to use a static IP. Allow access from that IP in your firewall settings. Once connected, you will see that PostgreSQL has been automatically selected as the data source in your node.
On the right side of the screen, you will see the input data we receive from Dixa. These are test data for now, but we can edit them later. To retrieve specific data from the database, write an SQL query. For example, we can use a simple SELECT statement to retrieve all customer data where the email address matches the customer email. By using a variable starting with a dollar sign, the query will replace the variable with the data received from the custom card in Dixa.
After running the query, we may not see any results if the test data does not match the database records. To edit the input data, simply modify it in the input data section. Once the query returns the desired results, we can proceed to configure the data pipeline.
The data pipeline in FactBranch is triggered when a user opens a Dixa conversation and the custom card is loaded. The pipeline then runs the PostgreSQL query and takes the retrieved data to generate a UI. FactBranch offers a convenient feature where it automatically generates a simple HTML UI based on the data received. If needed, you can edit the HTML template to customize the UI further.
FactBranch is using a Jinja2/Liquid-style templating language. Don't forget to check out more advanced uses in our docs.
To display the data in a Dixa conversation, we need to create a custom card in Dixa and integrate it with FactBranch. In the FactBranch trigger configuration, you will find a guide on how to set up the custom card in Dixa. Follow the steps you find in the trigger config to create a custom card in Dixa.
Save the custom card settings, and when you go back to the conversation in Dixa, you will see the FactBranch custom card loading data from your database and displaying it in the sidebar next to the conversation.
By using FactBranch and creating a custom card in Dixa, you can now display data from a PostgreSQL database in a Dixa conversation. The integration between Dixa, FactBranch and your Postgres database allows for a seamless flow of information, providing agents with the data they need right where they need it. Allowing them to help your customers faster.