{
  "slug": "Find-a-list-of-tickets-for-the-customers-in-FreshDesk-f4bf843c55ff",
  "title": "Find a list of tickets for the customers in FreshDesk",
  "subtitle": "In this tutorial, I want to write a Python code for the extraction of a customer tickets list with FreshDesk API.",
  "excerpt": "In this tutorial, I want to write a Python code for the extraction of a customer tickets list with FreshDesk API.",
  "date": "2024-05-08",
  "tags": [
    "Design Rag System",
    "Python",
    "API"
  ],
  "readingTime": "1 min",
  "url": "https://medium.com/@mobinshaterian/find-a-list-of-tickets-for-the-customers-in-freshdesk-f4bf843c55ff",
  "hero": "https://cdn-images-1.medium.com/max/800/1*P3DGYf7PUCR_40uGaKsl5Q.jpeg",
  "content": [
    {
      "type": "paragraph",
      "html": "In this tutorial, I want to write a Python code for the extraction of a customer tickets list with FreshDesk API."
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*P3DGYf7PUCR_40uGaKsl5Q.jpeg",
      "alt": "Find a list of tickets for the customers in FreshDesk",
      "caption": "",
      "width": 640,
      "height": 832
    },
    {
      "type": "paragraph",
      "html": "FreshDesk is a customer support management system that deals with tickets. It also has an API for accessing client requests and data and a good developer document."
    },
    {
      "type": "paragraph",
      "html": "It also has a Python library to connect with Freshdesk."
    },
    {
      "type": "paragraph",
      "html": "Now I want to get list of tickets of special customer."
    },
    {
      "type": "code",
      "lang": "python",
      "code": "from freshdesk.api\nimport API\nfrom dotenv\nimport load_dotenv\nimport osload_dotenv()a = API(os.getenv('FRESHDESK_DOMAIN'), os.getenv('FRESHDESK_API_KEY') ,\nversion=2)ticket_number = 100ticket = a.tickets.get_ticket(ticket_number,\n\"requester\")ticket.requester"
    },
    {
      "type": "code",
      "lang": "text",
      "code": "{'id': 200003266492, 'name': 'Customer name ', 'email': 'test@gmail.com', 'mobile': None, 'phone':\nNone}"
    },
    {
      "type": "paragraph",
      "html": "And also can get a ticket ID by command below:"
    },
    {
      "type": "code",
      "lang": "text",
      "code": "ticket.requester['id']200003266492"
    },
    {
      "type": "paragraph",
      "html": "List of customer tickets:"
    },
    {
      "type": "code",
      "lang": "python",
      "code": "mylist = a.tickets.list_tickets(requester_id=ticket.requester['id'],filter_name=None)"
    },
    {
      "type": "paragraph",
      "html": "In part of filter_name, it is possible to set [‘new_and_my_open,’ ‘watching,’ ‘spam,’ ‘deleted,’ None] for different types of tickets status."
    },
    {
      "type": "paragraph",
      "html": "Visit us at <a href=\"https://www.datadriveninvestor.com/\" target=\"_blank\" rel=\"noreferrer noopener\"><em>DataDrivenInvestor.com</em></a>"
    },
    {
      "type": "paragraph",
      "html": "Subscribe to DDIntel <a href=\"https://www.ddintel.com/\" target=\"_blank\" rel=\"noreferrer noopener\"><em>here</em></a>."
    },
    {
      "type": "paragraph",
      "html": "Featured Article:"
    },
    {
      "type": "paragraph",
      "html": "Join our creator ecosystem <a href=\"https://join.datadriveninvestor.com/\" target=\"_blank\" rel=\"noreferrer noopener\"><em>here</em></a>."
    },
    {
      "type": "paragraph",
      "html": "DDI Official Telegram Channel: <a href=\"https://t.me/+tafUp6ecEys4YjQ1\" target=\"_blank\" rel=\"noreferrer noopener\">https://t.me/+tafUp6ecEys4YjQ1</a>"
    },
    {
      "type": "paragraph",
      "html": "Follow us on <a href=\"https://www.linkedin.com/company/data-driven-investor\" target=\"_blank\" rel=\"noreferrer noopener\"><em>LinkedIn</em></a>, <a href=\"https://twitter.com/@DDInvestorHQ\" target=\"_blank\" rel=\"noreferrer noopener\"><em>Twitter</em></a>, <a href=\"https://www.youtube.com/c/datadriveninvestor\" target=\"_blank\" rel=\"noreferrer noopener\"><em>YouTube</em></a>, and <a href=\"https://www.facebook.com/datadriveninvestor\" target=\"_blank\" rel=\"noreferrer noopener\"><em>Facebook</em></a>."
    }
  ]
}
