{
  "slug": "Get-Data-from-Fresh-Desk-with-API-Key-and-Write-Notes-with-Open-AI-5eee50365cbb",
  "title": "Get Data from Fresh Desk with API Key and Write Notes with Open AI",
  "subtitle": "In this article I want to get data from Fresh Desk via API key. and write note base on RAG open AI system.",
  "excerpt": "In this article I want to get data from Fresh Desk via API key. and write note base on RAG open AI system.",
  "date": "2024-02-28",
  "tags": [
    "Design Rag System",
    "API",
    "Machine Learning"
  ],
  "readingTime": "2 min",
  "url": "https://medium.com/@mobinshaterian/get-data-from-fresh-desk-with-api-key-and-write-note-with-open-ai-5eee50365cbb",
  "hero": "https://cdn-images-1.medium.com/max/800/1*wyL_-BzDEUnnWJQIYveA7g.jpeg",
  "content": [
    {
      "type": "heading",
      "level": 2,
      "text": "Get Data from Fresh Desk with API Key and Write Notes with Open AI"
    },
    {
      "type": "paragraph",
      "html": "In this article I want to get data from Fresh Desk via API key. and write note base on RAG open AI system."
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*wyL_-BzDEUnnWJQIYveA7g.jpeg",
      "alt": "Get Data from Fresh Desk with API Key and Write Notes with Open AI",
      "caption": "",
      "width": 640,
      "height": 832
    },
    {
      "type": "paragraph",
      "html": "Freshdesk is a cloud-based customer support platform that was founded with the mission of enabling companies of all sizes to provide great customer service. Our goal is simple: make it easy for brands to talk to their customers and make it easy for users to get in touch with businesses."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "API Document"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Authentication"
    },
    {
      "type": "code",
      "lang": "bash",
      "code": "curl -v -u apikey:X -H \"Content-Type: application/json\" -X GET\n'https://domain.freshdesk.com/api/v2/tickets'"
    },
    {
      "type": "paragraph",
      "html": "example"
    },
    {
      "type": "code",
      "lang": "bash",
      "code": "curl -v -u abcdefghij1234567890:X -H \"Content-Type: application/json\" -X GET\n'https://domain.freshdesk.com/api/v2/tickets'"
    },
    {
      "type": "paragraph",
      "html": "<strong>Error You have to be logged in to perform this action.</strong>"
    },
    {
      "type": "paragraph",
      "html": "don’t forget to change domain into your company domain."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Python Framework"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Get Unread Tickets"
    },
    {
      "type": "code",
      "lang": "python",
      "code": "from freshdesk.api\nimport APIfd_api = API('domain.freshdesk.com', 'i***************' , version=2)new_tickets =\nfd_api.tickets.list_tickets( page=1, per_page=100)"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Get ticket Detail"
    },
    {
      "type": "code",
      "lang": "python",
      "code": "ticket_data = fd_api.tickets.get_ticket(ticket.id)"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Get user information"
    },
    {
      "type": "code",
      "lang": "python",
      "code": "contract_data = fd_api.contacts.get_contact(ticket_data.requester_id)"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Get the list of notes and replies"
    },
    {
      "type": "code",
      "lang": "python",
      "code": "comments = fd_api.comments.list_comments(ticket.id)"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "List All Tickets"
    },
    {
      "type": "paragraph",
      "html": "1. By default, only tickets that have been created within the <strong>past 30 days </strong>will be returned. For older tickets, use the <strong>updated_since</strong> filter&nbsp;<br>&nbsp;2. A maximum of 300 pages (30000 tickets) will be returned.&nbsp;<br>&nbsp;3. When using filters, the query string must be URL encoded — <a href=\"https://developers.freshdesk.com/api/#url_encoded_ticket_example\" target=\"_blank\" rel=\"noreferrer noopener\">see example</a><br>&nbsp;4. Use ‘include’ to embed additional details in the response. Each include will consume an additional 2 credits. For example if you embed the stats information you will be charged a total of 3 API credits for the call.<br>&nbsp;5. For accounts created after 2018–11–30, you will have to use include to get description."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "RAG"
    },
    {
      "type": "paragraph",
      "html": "Now data is ready and can be sent to the RAG system. I explain it in another article."
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Stackademic 🎓"
    },
    {
      "type": "paragraph",
      "html": "Thank you for reading until the end. Before you go:"
    },
    {
      "type": "list",
      "ordered": false,
      "items": [
        "Please consider <strong>clapping</strong> and <strong>following</strong> the writer! 👏",
        "Follow us <a href=\"https://twitter.com/stackademichq\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>X</strong></a><strong> | </strong><a href=\"https://www.linkedin.com/company/stackademic\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>LinkedIn</strong></a><strong> | </strong><a href=\"https://www.youtube.com/c/stackademic\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>YouTube</strong></a><strong> | </strong><a href=\"https://discord.gg/in-plain-english-709094664682340443\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Discord</strong></a>",
        "Visit our other platforms: <a href=\"https://plainenglish.io/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>In Plain English</strong></a><strong> | </strong><a href=\"https://cofeed.app/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>CoFeed</strong></a><strong> | </strong><a href=\"https://venturemagazine.net/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Venture</strong></a><strong> | </strong><a href=\"https://blog.cubed.run/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Cubed</strong></a>",
        "More content at <a href=\"https://stackademic.com/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Stackademic.com</strong></a>"
      ]
    }
  ]
}
