Freshdesk
Freshdesk is a cloud-based customer service software that provides businesses with tools for managing customer support via multiple channels including email, phone, websites, and social media.
This Freshdesk dlt
verified source and
pipeline example
loads data using the "Freshdesk API" to the destination of your choice.
Resources that can be loaded using this verified source are:
S.No. | Name | Description |
---|---|---|
1. | agents | Users responsible for managing and resolving customer inquiries and support tickets. |
2. | companies | Customer organizations or groups that agents support. |
3. | contacts | Individuals or customers who reach out for support. |
4. | groups | Agents organized based on specific criteria. |
5. | roles | Predefined sets of permissions that determine what actions an agent can perform. |
6. | tickets | Customer inquiries or issues submitted via various channels like email, chat, phone, etc. |
Setup Guide
Grab credentials
To obtain your Freshdesk credentials, follow these steps:
- Log in to your Freshdesk account.
- Click on the profile icon to open "Profile Settings".
- Copy the API key displayed on the right side.
Note: The Freshdesk UI, which is described here, might change. The full guide is available at this link.
Initialize the verified source
To get started with your data pipeline, follow these steps:
Enter the following command:
dlt init freshdesk duckdb
This command will initialize the pipeline example with Freshdesk as the source and duckdb as the destination.
If you'd like to use a different destination, simply replace
duckdb
with the name of your preferred destination.After running this command, a new directory will be created with the necessary files and configuration settings to get started.
For more information, read the guide on how to add a verified source.
Add credentials
In the
.dlt
folder, there's a file calledsecrets.toml
. It's where you store sensitive information securely, like access tokens. Keep this file safe. Here's what the file looks like:# Put your secret values and credentials here
# Github access token (must be classic for reactions source)
[sources.freshdesk]
domain = "please set me up!" # Enter the freshdesk domain here
api_secret_key = "please set me up!" # Enter the freshdesk API key hereIn the
domain
, enter the domain of your Freshdesk account.In
api_secret_key
, enter the API key you copied above.
Run the pipeline
- Before running the pipeline, ensure that you have installed all the necessary dependencies by
running the command:
pip install -r requirements.txt
- You're now ready to run the pipeline! To get started, run the following command:
python freshdesk_pipeline.py
- Once the pipeline has finished running, you can verify that everything loaded correctly by using
the following command:For example, the
dlt pipeline <pipeline_name> show
pipeline_name
for the above pipeline example isfreshdesk_pipeline
, you may also use any custom name instead.
For more information, read the guide on how to run a pipeline.
Sources and resources
dlt
works on the principle of sources and
resources.
Source freshdesk_source
This function retrives the data from specified Freshdesk API endpoints.
@dlt.source()
def freshdesk_source(
endpoints: Optional[List[str]] = None,
per_page: int = 100,
domain: str = dlt.secrets.value,
api_secret_key: str = dlt.secrets.value,
) -> Iterable[DltResource]:
...
This source supports pagination and incremental data loading. It fetches data from a list of specified endpoints, or defaults to predefined endpoints in "settings.py".
endpoints
: A list of Freshdesk API endpoints to fetch. Defaults to "settings.py".
per_page
: The number of items to fetch per page, with a maximum of 100.
domain
: The Freshdesk domain from which to fetch the data. Defaults to "config.toml".
api_secret_key
: Freshdesk API key. Defaults to "secrets.toml".
Resource endpoints
This function creates and yields a dlt resource for each endpoint in "settings.py".
@dlt.source()
def freshdesk_source(
#args as defined above
) -> Iterable[DltResource]:
for endpoint in endpoints:
yield dlt.resource(
incremental_resource,
name=endpoint,
write_disposition="merge",
primary_key="id",
)(endpoint=endpoint)
incremental_resource
: A function that fetches and yields paginated data from a specified API endpoint.
name
: Specifies the name of the endpoint.
write_disposition
: Specifies the write disposition to load data.
primary_key
: Specifies "id" as primary key of the resource.
Customization
Create your own pipeline
If you wish to create your own pipelines, you can leverage source and resource methods from this verified source.
Configure the pipeline by specifying the pipeline name, destination, and dataset as follows:
pipeline = dlt.pipeline(
pipeline_name="freshdesk_pipeline", # Use a custom name if desired
destination="duckdb", # Choose the appropriate destination (e.g., duckdb, redshift, post)
dataset_name="freshdesk_data" # Use a custom name if desired
)To read more about pipeline configuration, please refer to our documentation.
To load data from all the endpoints, specified in "settings.py".
load_data = freshdesk_source()
# Run the pipeline
load_info = pipeline.run(load_data)
# Print the pipeline run information
print(load_info)To load the data from "agents", "contacts", and "tickets":
load_data = freshdesk_source().with_resources("agents", "contacts", "tickets")
# Run the pipeline
load_info = pipeline.run(load_data)
# Print the pipeline run information
print(load_info)
Additional Setup guides
- Load data from GitHub to AlloyDB in python with dlt
- Load data from GitHub to Redshift in python with dlt
- Load data from GitHub to Databricks in python with dlt
- Load data from GitHub to Azure Cosmos DB in python with dlt
- Load data from GitHub to Neon Serverless Postgres in python with dlt
- Load data from GitHub to Azure Cloud Storage in python with dlt
- Load data from GitHub to ClickHouse in python with dlt
- Load data from GitHub to CockroachDB in python with dlt
- Load data from GitHub to DuckDB in python with dlt
- Load data from GitHub to MotherDuck in python with dlt