How to load data from Zendesk Chat to PostgreSQL

Avatar

This post helps you with syncing your customer support data from Zendesk Chat to PostgreSQL. If you are looking to get analytics-ready data without the manual hassle you can integrate Zendesk Chat to PostgreSQL with Blendo, so you can focus on what matters, getting value out of the analysis of your customer support data.

Access your data on Zendesk Chat

The first step in loading your Zendesk Chat data to any kind of data warehouse solution is to access your data and start extracting it.

Zendesk Chat offers a rich and well defined API that belongs to the Representational State Transfer (REST) category. Using it you can perform RESTful operations such as reading, modifying, adding and deleting of your helpdesk data, thus allowing you to programmatically interact with your account.

Among the 10 provided resources, you can find information about Accounts, Agents, Visitors, Chats, Shortcuts, Triggers, Bans, Departments, Goals, Skills and Roles.

You will need more time to read this post than integrating Zendesk Chat to PostgreSQL.

Effortlessly Sync All Your Zendesk Chat Data to PostgreSQL

In addition to the above, the things that you have to keep in mind when dealing with the Zendesk Chat API, are:

  • Rate limits. The API is rate limited, i.e. it only allows a certain number of requests per minute.
  • Authentication. If the Zendesk Chat account is created in Zendesk Support, the user must authenticate with an OAuth access token.
    If a stand-alone Chat account is used then either a basic authentication can be used or an OAuth access token.
  • Paging and dealing with big amount of data.

 

About Zendesk Chat

Zendesk Chat is a live chat solution that helps businesses increase sales conversion by engaging important leads on their websites.

While using Zendesk Chat as your live chat you can anticipate customer questions and offer help when—and where—they need it most using chat. This way the agents can help more customers in less time, which means happier customers more of the time.

In more details by using Zendesk Chat you can:

  • Display chats and agents metrics
  • Create and display a real time dashboard
  • Monitor a specific department
  • Predict or estimate capacity and other derived metrics

Transform and prepare your Zendesk Chat Data

After you have accessed your data on Zendesk Chat, you will have to transform it based on two main factors,

  1. The limitations of the database that the data will be loaded onto
  2. The type of analysis that you plan to perform

Each system has specific limitations on the data types and data structures that it supports. If for example, you want to push data into Google BigQuery, then you can send nested data like JSON directly.

Of course, when you are dealing with tabular data stores, like Microsoft SQL Server, this is not an option. Instead, you will have to flatten out your data, just as in the case of JSON, before loading into the database.

Also, you have to choose the right data types. Again, depending on the system that you will send the data to and the data types that the API exposes to you, you will have to make the right choices. These choices are important because they can limit the expressivity of your queries and limit your analysts on what they can do directly out of the database. Zendesk Chat has a very limited set of available data types which means that your work to do these mappings is much easier and straight forward, but nonetheless equally important with any other case of a data source.

Due to the rich and complex data model that Zendesk Chat follows, some of the provided resources might have to be flattened out and be pushed in more that one tables.

Load data from Zendesk Chat to PostgreSQL

For example, if you an endpoint from Zendesk Chat returns a value as String, you should convert it into a VARCHAR with a predefined max size or TEXT data type. tables can then be created on your database using the CREATE SQL statement.

Once you have defined your schema and you have created your tables with the proper data types, you can start loading data into your database.

The preferred way of adding larger datasets into a PostgreSQL database is by using the COPY command. COPY is copying data from a file on a file system that is accessible by the Postgres instance, in this way much larger datasets can be inserted into the database in less time. COPY requires physical access to a file system in order to load data.

Nowadays, with the cloud-based, fully managed databases, getting direct access to a file system is not always possible. If this is the case and you cannot use a COPY statement, then another option is to use PREPARE together with INSERT, to end up with optimized and more performant INSERT queries.

Updating your Zendesk Chat data on PostgreSQL

As you will be generating more data on Zendesk Chat, you will need to update your older data on PostgreSQL. This includes new records together with updates to older records that for any reason have been updated on Zendesk Chat.

You will need to periodically check Zendesk Chat for new data and repeat the process that has been described previously while updating your currently available data if needed. Updating an already existing row on a PostgreSQL table is achieved by creating UPDATE statements.

Another issue that you need to take care of is the identification and removal of any duplicate records on your database. Either because Zendesk Chat does not have a mechanism to identify new and updated records or because of errors on your data pipelines, duplicate records might be introduced to your database.

In general, ensuring the quality of the data that is inserted in your database is a big and difficult issue and PostgreSQL features like TRANSACTIONS can help tremendously, although they do not solve the problem in the general case.

The best way to load data from Zendesk Chat to PostgreSQL

So far we just scraped the surface of what you can do with PostgreSQL and how to load data into it. Things can get even more complicated if you want to integrate data coming from different sources.

Are you striving to achieve results right now?

Instead of writing, hosting and maintaining a flexible data infrastructure use Blendo that can handle everything automatically for you.

Blendo with one click integrates with sources or services, creates analytics-ready data and syncs your Zendesk Chat to PostgreSQL right away.

Help your customer support and executive team take ownership of the insights that live in your Zendesk Chat customer support platform.

Blendo is the easiest way to automate powerful data integrations.

Try Blendo free for 14 days. No credit card required.