How to show PostgreSQL data in Zendesk

In this guide you'll learn how to connect to a PostgreSQL database from FactBranch and design data outputs for the FactBranch app in Zendesk. Using FactBranch and SQL queries you can show your agents customer information whenever they open a ticket.

What is FactBranch?

FactBranch is an app for Zendesk that loads customer info from a variety of external sources and displays them in Zendesk next to the ticket. In this blog post we'll discuss how to connect FactBranch to your Postgres database. FactBranch queries the database and shows the results to your agents. In Zendesk the FactBranch app looks like this:


Help! I don't know how to write SQL!

If you don't have anybody at your company who can write an SQL query, please get in touch with a href="" and our team will gladly help you out.

If you know SQL, let's dive right into it and connect to your database.

How to connect to a PostgreSQL database in FactBranch

FactBranch has a flexible but easy-to-use setup wizard to create a connection to your database. First, you define an SQL query and then you design how the result(s) should be displayed in the FactBranch app in Zendesk.

1) Sign up for FactBranch

If you haven't done so already, create a FactBranch account. You don't need a credit card to sign up and each account comes with a 14 day free trial.

After creating an account you'll see a list of connections available in FactBranch. Select PostgreSQL.

2) Connecting to your database

Now enter your database credentials.


We recommend to create a special database user for FactBranch that has as few permissions as possible.

If you have to allow external IP addresses in your database server's firewall, activate "Use a static IP when making database requests" and allow access from the IP displayed in the yellow box. You might have to talk to your IT team to make this happen at your company.

Once you're ready to test the connection, hit "Test connection".

You should either get an error message telling you what went wrong – or a green "Success" box. Either fix the errors and test again, or click "Save and continue".

3) The SQL query editor

This is the SQL query editor:


The big black field in the center is the editor itself, giving you lots of space for even complicated queries. On the right you can test your query by searching for an email address.

First enter the query you'd like to run each time an agent opens a ticket. You can use any SQL that your server understands.

To search for an email address, make sure to include a WHERE clause like this:


The important part is "%(email)s". When FactBranch queries your database. This part will be replaced by the email address you want to find.

Once you're happy with the query, test it on the right by entering an email address you know exists in your database and hitting "Search".


Make absolutely sure that each field has a unique name. For example if your query produces two columns called "ID", use SQL like "AS customer_id" and "AS order_id" to make them unique.

Once you get the desired results, click "Continue" in the top right corner of the page to get to the Output Designer.

4) Designing the results for the FactBranch app

In the final step you can rearrange the items and rename their labels.


The area on the right shows you a preview how the result will look in Zendesk. If you want to rename a label, select the label-field in the editor and simply make the changes.

To change the order, drag one of the items up or down in the editor in the center. You can grab the items anywhere except the input-field.

Check the preview on the right. And once you're happy with the results, click "Finish". You'll be redirected to your list of integrations.

5) Install the FactBranch app from the Zendesk Marketplace

If you haven't installed the FactBranch Zendesk app yet, you'll see a blue box asking you to install the app.


Copy the FactBranch API-key and then click on the button Install FactBranch in Zendesk. On the Marketplace page hit the Install button and when prompted, paste the API-key you've copied just now.


Click the Install button one last time.

5) Done!

Now when you open a ticket, FactBranch looks up the customer in your Postgres database and displays their info in the ticket sidebar.



If you have questions or need additional features, please get in touch via We'd love to hear from you and we'll reply to your email within a few business hours.

Want to help your customers faster?

Sign up for our newsletter to get our freshest insights and product updates.

We care about the protection of your data. Read our Privacy Policy.