Importing Ticket Data from Zendesk API to Weaviate
Zendesk is a cloud-based customer service and support platform. Zendesk Support API, which is also known as the Ticketing API lets’s you access support tickets data. By analyzing this data, businesses can gain insights into customer needs, behavior, trends, and make data-driven decisions. The newest type of databases, vector databases, can help in advanced analysis of tickets data such as identifying common issues and sentiment analysis.
In this walkthrough, we’ll show you how to import Zendesk ticket data to one of the vector databases, Weaviate. We’ll use dlt to connect to the Zendesk API, extract the ticket data, and load it into Weaviate for querying.
For our example we will use "subject" and "description" fields from a ticket as a text content to perform vector search on.
We're going to use some ready-made components from the dlt ecosystem to make this process easier:
- A Zendesk verified source to extract the tickets from the API.
- A Weaviate destination to load the data into a Weaviate instance.
Create a new folder for your project, navigate to it, and create a virtual environment:
python -m venv venv
Install dlt with Weaviate support
pip install "dlt[weaviate]"
Install dlt Zendesk verified source
dlt init zendesk weaviate
The last command dlt init initializes dlt project: it downloads the verified source and installs it in your project folder.
Before we configure the source and destination, you need to make sure you have access to API in both Zendesk and Weaviate.
Head to the Zendesk docs to see how to fetch credentials for Zendesk API. In our walkthrough, we're using the email address and password authentication method. Once you have fetched the credentials, you can configure the source. Add the following lines to the dlt secrets file
password = "..."
subdomain = "..."
email = "..."
For the destination we're using Weaviate Cloud Services. You would need to create an account and get a URL and an API key for your Weaviate instance. We're also be using OpenAI API to generate embeddings for the text data needed to perform vector search. If you haven't already, you would need to create an account and get an API key for OpenAI API.
When you have the credentials, add more lines to the dlt secrets file
url = "https://weaviate_url"
api_key = "api_key"
X-OpenAI-Api-Key = "sk-..."
Customizing the pipeline
When you run
dlt init zendesk weaviate, dlt creates a file called
zendesk_pipeline.py in the current directory. This file contains an example pipeline that you can use to load data from Zendesk source. Let's edit this file to make it work for our use case:
from dlt.destinations.weaviate import weaviate_adapter
from zendesk import zendesk_support
# 1. Create a pipeline
pipeline = dlt.pipeline(
# 2. Initialize Zendesk source to get the ticket data
zendesk_source = zendesk_support(load_all=False)
tickets = zendesk_source.tickets
info = pipeline.run(
# 3. Here we use a special function to tell Weaviate
# which fields to vectorize
if __name__ == "__main__":
load_info = main()
Let's go through the code above step by step:
- We create a pipeline with the name
weaviate_zendesk_pipelineand the destination
- Then, we initialize the Zendesk verified source. We only need to load the tickets data, so we get
ticketsresource from the source by getting the
- Weaviate is a special kind of destination that requires vectorizing (or embedding) the data before loading it. Here, we use the
weaviate_adapter()function to tell dlt which fields Weaviate should vectorize. In our case, we vectorize the
descriptionfields from each ticket. That means that Weaviate will be able to perform vector search (or similarity search) on content of these fields.
pipeline.run()runs the pipeline and returns information about the load process.
Running the pipeline
Now that we have the pipeline configured, we can run the Python script:
We have successfully loaded the data from Zendesk to Weaviate. Let's check it out.
Query the data
We can now run a vector search query on the data we loaded into Weaviate. Create a new Python file called
query.py and add the following code:
client = weaviate.Client(
response = (
.get("ZendeskData_Tickets", ["subject", "description"])
"concepts": ["problems with password"],
The above code instantiates a Weaviate client and does a similarity search on the data we loaded. The query searches for tickets that are similar to the text “problems with password”. The output should be similar to:
"subject": "How do I change the password for my account?",
"description": "I forgot my password and I can't log in.",
"subject": "I can't log in to my account.",
"description": "The credentials I use to log in don't work.",
During our first load, we loaded all tickets from Zendesk API. But what if users create new tickets? Or update existing ones? dlt solves this case by supporting incremental loading. And you don't need to change anything in your pipeline to enable it: Zendesk source supports incremental loading out of the box based on the
updated_at field. That means that dlt will only load tickets that were created or updated after the last load.
If you interested in learning more about Weaviate support in dlt, check out the Weaviate destination docs. We have also have demos of different sources of data for Weaviate in our Jyputer notebooks: