Get Data from Fresh Desk with API Key and Write Notes with Open AI
In this article I want to get data from Fresh Desk via API key. and write note base on RAG open AI system.
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.
API Document
Authentication
curl -v -u apikey:X -H "Content-Type: application/json" -X GET
'https://domain.freshdesk.com/api/v2/tickets'example
curl -v -u abcdefghij1234567890:X -H "Content-Type: application/json" -X GET
'https://domain.freshdesk.com/api/v2/tickets'Error You have to be logged in to perform this action.
don’t forget to change domain into your company domain.
Python Framework
Get Unread Tickets
from freshdesk.api
import APIfd_api = API('domain.freshdesk.com', 'i***************' , version=2)new_tickets =
fd_api.tickets.list_tickets( page=1, per_page=100)Get ticket Detail
ticket_data = fd_api.tickets.get_ticket(ticket.id)Get user information
contract_data = fd_api.contacts.get_contact(ticket_data.requester_id)Get the list of notes and replies
comments = fd_api.comments.list_comments(ticket.id)List All Tickets
1. By default, only tickets that have been created within the past 30 days will be returned. For older tickets, use the updated_since filter
2. A maximum of 300 pages (30000 tickets) will be returned.
3. When using filters, the query string must be URL encoded — see example
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.
5. For accounts created after 2018–11–30, you will have to use include to get description.
RAG
Now data is ready and can be sent to the RAG system. I explain it in another article.
Stackademic 🎓
Thank you for reading until the end. Before you go:
- Please consider clapping and following the writer! 👏
- Follow us X | LinkedIn | YouTube | Discord
- Visit our other platforms: In Plain English | CoFeed | Venture | Cubed
- More content at Stackademic.com
