Title: | Connect to Your 'Zendesk' Data |
---|---|
Description: | Facilitates making a connection to the 'Zendesk' API and executing various queries. You can use it to get ticket, ticket metrics, and user data. The 'Zendesk' documentation is available at <https://developer.zendesk.com/rest_api /docs/support/introduction>. This package is not supported by 'Zendesk' (owner of the software). |
Authors: | Chris Umphlett [aut, cre], Avinash Panigrahi [aut] |
Maintainer: | Chris Umphlett <[email protected]> |
License: | CC0 |
Version: | 0.4.1.9000 |
Built: | 2024-11-21 04:20:10 UTC |
Source: | https://github.com/chrisumphlett/zdeskr |
This function takes your Email Id, authentication token, and sub-domain and parses all the tickets and its corresponding metrics in a list. Since each iteration only returns 100 tickets at a time you must run the loop until the "has_more" parameter is equal to FALSE.
get_all_ticket_metrics(email_id, token, subdomain)
get_all_ticket_metrics(email_id, token, subdomain)
email_id |
Zendesk Email Id (username). |
token |
Zendesk API token. |
subdomain |
Your organization's Zendesk sub-domain. |
Its not a good practice to write down these authentication parameters in your code. There are various methods and packages available that are more secure; this package doesn't require you to use any one in particular.
Data Frame with metrics for all tickets
https://developer.zendesk.com/rest_api/docs/support/ticket_metrics
## Not run: ticket_metrics <- get_all_ticket_metrics(email_id, token, subdomain) ## End(Not run)
## Not run: ticket_metrics <- get_all_ticket_metrics(email_id, token, subdomain) ## End(Not run)
It takes your Email Id, authentication token, sub-domain as parameters and gets the system and all the custom fields available for a zendesk ticket.
get_custom_fields(email_id, token, subdomain)
get_custom_fields(email_id, token, subdomain)
email_id |
Zendesk Email Id (username). |
token |
Zendesk API token. |
subdomain |
Your organization's Zendesk sub-domain. |
It's not a good practice to write down these authentication parameters in your code. There are various methods and packages available that are more secure; this package doesn't require you to use any one in particular.
A data frame containing all ticket fields
https://developer.zendesk.com/rest_api/docs/support/ticket_fields
## Not run: fields <- get_custom_fields(email_id, token, subdomain) ## End(Not run)
## Not run: fields <- get_custom_fields(email_id, token, subdomain) ## End(Not run)
This function takes your Email Id, authentication token, sub-domain and start time as parameters and gets all the tickets which have been updated on or after the start time parameter. By default each page returns 1000 unique tickets and an "after_cursor" value which stores a pointer to the next page. After getting the first page it uses the pointer to fetch the subsequent pages.
get_tickets(email_id, token, subdomain, start_time, remove_cols = NULL)
get_tickets(email_id, token, subdomain, start_time, remove_cols = NULL)
email_id |
Zendesk Email Id (username). |
token |
Zendesk API token. |
subdomain |
Your organization's Zendesk sub-domain. |
start_time |
String with a date or datetime to get all tickets modified after that date. |
remove_cols |
Vector of column names to remove from the results. |
The start time parameter should be in 'UTC' format as Zendesk uses the 'UTC' time zone when retrieving tickets after the start time. For example, the US Eastern Time Zone is currently four hours being UTC. If one wanted to get tickets starting on August 1 at 12 am, you would need to enter "2020-08-01 04:00:00". The user must do proper adjustment to accommodate the time zone difference, if desired. A date can be provided, it will retrieve results as of 12 am in the UTC time zone.
Start and end times can be entered with or without the time component. End time cannot be in the future, but should work for values up to one minute prior to the current time.
It's not a good practice to write down these authentication parameters in your code. There are various methods and packages available that are more secure; this package doesn't require you to use any one in particular.
The remove_cols parameter allows the removal of custom fields causing errors. Errors occurred when a field was sometimes blank and assigned a logical type and then appended to non-blank, non-logical inside of purrr::map_dfr. See issue #1 on GH.
a Data Frame containing all tickets after the start time.
https://developer.zendesk.com/rest_api/docs/support/incremental_export#start_time
## Not run: all_tickets <- get_tickets(email_id, token, subdomain, start_time = "2021-01-31 00:00:00", end_time = "2021-01-31 23:59:59" ) ## End(Not run)
## Not run: all_tickets <- get_tickets(email_id, token, subdomain, start_time = "2021-01-31 00:00:00", end_time = "2021-01-31 23:59:59" ) ## End(Not run)
This function takes your email ID, authentication token, sub-domain, and specific ticket ID to fetch all comments/replies to this wanted ticket.
get_tickets_comments( email_id, token, subdomain, ticket_id, add_cols = NULL, metadata = FALSE )
get_tickets_comments( email_id, token, subdomain, ticket_id, add_cols = NULL, metadata = FALSE )
email_id |
Zendesk Email ID (username). |
token |
Zendesk API token. |
subdomain |
Your organization's Zendesk sub-domain. |
ticket_id |
The ticket ID number. A numeric value. |
add_cols |
Vector of column names to select in addition to the default. |
metadata |
Logical value (TRUE or FALSE). If TRUE, metadata columns will be included. This is set to FALSE by default. |
By default only these columns are returned: "id", "type", "author_id", "body", "created_at", "have_attachments". You can add other variables using the 'add_cols' parameter. The variables that can be inserted are described in the Zendesk API documentation: https://developer.zendesk.com/api-reference/ ticketing/tickets/ticket_comments/.
The meaning of the default columns included are described in the previous link, except "have-attachments" which is a boolean field that will be "Yes" if the comment has an attachment or "No" if it does not. The attachment itself cannot be returned.
If you request the 'metadata' sensitive data (location, lat, long, IP address, etc.) will be included. This data should be handled with care and only stored and used per your organization's policies and applicable privacy regulations.
a Data Frame containing all comments/replies for a single ticket.
https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_comments/
## Not run: ## Extracting comments with default columns and without sensitive data comments_ticket_id <- get_tickets_comments(email_id, token, subdomain, ticket_id, add_cols = NULL, metadata = FALSE) ## Extracting comments with additional columns and sensitive data comments_ticket_id <- get_tickets_comments(email_id, token, subdomain, ticket_id, add_cols = c("html_body", "attachments"), metadata = TRUE) ## End(Not run)
## Not run: ## Extracting comments with default columns and without sensitive data comments_ticket_id <- get_tickets_comments(email_id, token, subdomain, ticket_id, add_cols = NULL, metadata = FALSE) ## Extracting comments with additional columns and sensitive data comments_ticket_id <- get_tickets_comments(email_id, token, subdomain, ticket_id, add_cols = c("html_body", "attachments"), metadata = TRUE) ## End(Not run)
It takes your Email Id, authentication token, sub-domain and parse all the users in a list. It iterates through all the pages returning only 100 users per page until the "next_page" parameter becomes null indicating there are no more pages to fetch.
get_users(email_id, token, subdomain, start_time, user_role = "all")
get_users(email_id, token, subdomain, start_time, user_role = "all")
email_id |
Zendesk Email Id (username). |
token |
Zendesk API token. |
subdomain |
Your organization's Zendesk sub-domain. |
start_time |
String with a date or datetime to get all tickets modified after that date. |
user_role |
User role, one of "all", "end-user", "agent", or "admin". |
It's not a good practice to write down these authentication parameters in your code. There are various methods and packages available that are more secure; this package doesn't require you to use any one in particular.
The start_page parameter is useful if you have many users. Each page contains 100 users. Zendesk does not have an incremental method for pulling users by date but after you retrieve all of your users once, you can then increment your start page to something that will limit the number of users you are re-pulling each time.
If you are pulling partial lists of users be aware that you will not get updates on older users. You will only get recently created users, not modified/deleted users and their modified data nor updated last login dates.
Data Frame with user details
https://developer.zendesk.com/rest_api/docs/support/users
## Not run: users <- get_users(email_id, token, subdomain) ## End(Not run)
## Not run: users <- get_users(email_id, token, subdomain) ## End(Not run)