Freshdesk

Overview

Freshdesk is an omnichannel customer support platform. This Parsons integration with the Freshdesk API provides methods to fetch tickets, contacts, companies, and agents. Results are returned as Parsons Tables.

Note

Authentication

To use the Freshdesk class, you must provide the subdomain of your Freshdesk account and an API Key, which can be found by logging into Freshdesk and following the instructions in the API documentation.

Note

Rate Limits

Rate limits depend on your Freshdesk plan, so be sure to check the API documentation for your rate limits and follow the best practices guide to avoid exceeding them.

Quickstart

To instantiate the Freshdesk class, you can either store your Freshdesk domain and API Key as environmental variables (FRESHDESK_DOMAIN and FRESHDESK_API_KEY, respectively) or pass them in as keyword arguments:

from parsons import Freshdesk

# First approach: Use environmental variables
freshdesk = Freshdesk()

# Second approach: Use keyword arguments
freshdesk = Freshdesk(domain='my_domain', api_key='my_api_key')

You can then call various endpoints:

# Fetch all tickets requested a individual based on their email
freshdesk.get_tickets(requester_email='user@email.com')

# Fetch all contacts in a specific company
freshdesk.get_contacts(company_id='123')

# Fetch a specific agent by their mobile number
freshdesk.get_agents(mobile='7654367287')

API

class parsons.freshdesk.freshdesk.Freshdesk(domain, api_key)[source]

Instantiate Freshdesk class

Parameters:
  • domain – str The subdomain of the Freshdesk account. Not required if FRESHDESK_DOMAIN env variable set.

  • api_key – str The Freshdesk provided application key. Not required if FRESHDESK_API_KEY env variable set.

Returns:

Freshdesk class

get_tickets(ticket_type=None, requester_id=None, requester_email=None, company_id=None, updated_since='2016-01-01', expand_custom_fields=False)[source]

List tickets.

See the API Docs for more information.

Warning

Deleted and Spam tickets are not included. However they can be pulled separately by utilizing the ticket_type parameter.

Warning

Freshdesk will return a maximum of 9,000 tickets. By default, only tickets created in the past 30 days are returned. To access additional tickets, utilize the updated_since parameter.

Parameters:
  • ticket_type – str Filter by type of ticket to filter by. Valid fields include new_and_my_open, watching, spam and deleted.

  • requester_id – int Filter by requester id.

  • requester_email – str Filter by requester email.

  • company_id – int Filter by company_id.

  • updated_since – str Earliest date to include in results.

  • expand_custom_fields – boolean Expand nested custom fields to their own columns.

Returns:

Parsons Table

See Parsons Table for output options.

get_contacts(email=None, mobile=None, phone=None, company_id=None, state=None, updated_since=None, expand_custom_fields=None)[source]

Get contacts.

See the API Docs for more information.

Parameters:
  • email (str) – Filter by email address.

  • mobile (str) – Filter by mobile phone number.

  • phone (str) – Filter by phone number.

  • company_id (int) – Filter by company ID.

  • state (str) – Filter by state.

  • updated_since (str) – Earliest date to include in results.

  • expand_custom_fields (bool) – Expand nested custom fields to their own columns.

Returns:

See Parsons Table for output options.

Return type:

parsons.Table

get_companies(expand_custom_fields=False)[source]

List companies.

See the API Docs for more information.

Parameters:

expand_custom_fields – boolean Expand nested custom fields to their own columns.

Returns:

Parsons Table

See Parsons Table for output options.

get_agents(email=None, mobile=None, phone=None, state=None)[source]

List agents.

See the API Docs for more information.

Parameters:
  • email – str Filter by email address.

  • mobile – str Filter by mobile phone number

  • phone – str Filter by phone number

  • state – str Filter by state

Returns:

Parsons Table

See Parsons Table for output options.

create_ticket(subject, description, email, priority, status, cc_emails=None, custom_fields=None)[source]

Create a ticket in Freshdesk.

Parameters:
  • subject – str The subject of the ticket.

  • description – str The description of the ticket.

  • email – str The email address of the requester.

  • priority – int The priority of the ticket.

  • status – int The status of the ticket.

  • cc_emails – list (optional) List of email addresses to CC.

  • custom_fields – dict (optional) Custom fields data.

Returns:

dict

JSON response from the API.