- Authentication
API Documentation
Get chat history
This endpoint allows you to fetch chat history
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Allows you to fetch chat history for a particular source, or all sources. Valid values are “all”,“zendesk”,“slack”,“discord”,“widget”,“intercom”,“ui”,“api”
Epoch timestamp in milliseconds for the start date of history
Epoch timestamp in milliseconds for the end date of history
import requests
url = "https://api-prod.usefini.com/v2/bots/requests/public"
token = "your_api_key_here" # Best stored in secrets management
headers = {"Authorization": "Bearer " + token}
params = {
'source': ['zendesk', 'api'], # Replace with desired source
'startEpoch': 1633046400000, # Replace with desired start epoch timestamp in milliseconds
'endEpoch': 1635638400000 # Replace with desired end epoch timestamp in milliseconds
}
# Make the GET request
response = requests.get(url, params=params, headers=headers)
# Check if the request was successful and print the response
if response.status_code == 200:
print(response.json())
else:
print(f"Failed to fetch data: {response.status_code}")
[
{
"botName": "Fini",
"createdAt": 1704725925544,
"source": "zendesk",
"question": "What is Fini?",
"answer": "Fini is your 24*7 agent resolving customer support queries in real-time -helping you save costs, and keep your customer happy. Fini securely integrates with your private data, and gives you an AI agent, ready 24/7 to solve customer queries on Zendesk, Slack, Discord and more",
"basedOn": [
{
"id": "c898051d33d3d26f81da6610e9a38377",
"entry": "2023-10-30 13:53:41.513721",
"score": 0.2764168887003209,
"title": "56760f7a-3254-421e-9b7a-7ebaca9e7534.md",
"answer": "Fini is your 24*7 agent resolving customer support queries in real-time -helping you save costs, and keep your customer happy. Fini securely integrates with your private data, and gives you an AI agent, ready 24/7 to solve customer queries on Zendesk, Slack, Discord and more",
"question": "What is Fini?",
"source_id": "https://usefini.com",
"source_type": "url"
}
],
"messageHistory": [
{
"role": "system",
"content": "Instruction - You are Clippy, a helpful agent and you are answering questions for customers and internal employees. Be casual, and excited to help your users. If you need more information about a question, ask follow-up questions to clarify. Let’s work this out in a step-by-step way to be sure we have the correct answer. Answer as concisely as possible. It’s very important to note that you are only allowed to give answers from the information given to you. If you can’t find the answer, say \\\"Let me have someone on the team look into this, and we will get back to you ASAP\\\". Never break character.. Answer based both on the general knowledge and the provided content"
}
]
}
]
Query
Allows you to fetch chat history for a particular source, or all sources. Valid values are “all”,“zendesk”,“slack”,“discord”,“widget”,“intercom”,“ui”,“api”
Epoch timestamp in milliseconds for the start date of history
Epoch timestamp in milliseconds for the end date of history
Response
Name of your bot in Fini Dashboard
Epoch timestamp corresponding to the exact time when the question was asked
Source used to ask the question
Question asked on Fini
Answer received from Fini
Categories assigned by Fini
This field gives detailed info on the knowledgebase used to formulate the answer
A list of messages comprising the conversation so far.
The role of the messages author. One of system
, user
, assistant
, or function
.
The contents of the message. content
is required for all messages except assistant messages with function calls.
import requests
url = "https://api-prod.usefini.com/v2/bots/requests/public"
token = "your_api_key_here" # Best stored in secrets management
headers = {"Authorization": "Bearer " + token}
params = {
'source': ['zendesk', 'api'], # Replace with desired source
'startEpoch': 1633046400000, # Replace with desired start epoch timestamp in milliseconds
'endEpoch': 1635638400000 # Replace with desired end epoch timestamp in milliseconds
}
# Make the GET request
response = requests.get(url, params=params, headers=headers)
# Check if the request was successful and print the response
if response.status_code == 200:
print(response.json())
else:
print(f"Failed to fetch data: {response.status_code}")
[
{
"botName": "Fini",
"createdAt": 1704725925544,
"source": "zendesk",
"question": "What is Fini?",
"answer": "Fini is your 24*7 agent resolving customer support queries in real-time -helping you save costs, and keep your customer happy. Fini securely integrates with your private data, and gives you an AI agent, ready 24/7 to solve customer queries on Zendesk, Slack, Discord and more",
"basedOn": [
{
"id": "c898051d33d3d26f81da6610e9a38377",
"entry": "2023-10-30 13:53:41.513721",
"score": 0.2764168887003209,
"title": "56760f7a-3254-421e-9b7a-7ebaca9e7534.md",
"answer": "Fini is your 24*7 agent resolving customer support queries in real-time -helping you save costs, and keep your customer happy. Fini securely integrates with your private data, and gives you an AI agent, ready 24/7 to solve customer queries on Zendesk, Slack, Discord and more",
"question": "What is Fini?",
"source_id": "https://usefini.com",
"source_type": "url"
}
],
"messageHistory": [
{
"role": "system",
"content": "Instruction - You are Clippy, a helpful agent and you are answering questions for customers and internal employees. Be casual, and excited to help your users. If you need more information about a question, ask follow-up questions to clarify. Let’s work this out in a step-by-step way to be sure we have the correct answer. Answer as concisely as possible. It’s very important to note that you are only allowed to give answers from the information given to you. If you can’t find the answer, say \\\"Let me have someone on the team look into this, and we will get back to you ASAP\\\". Never break character.. Answer based both on the general knowledge and the provided content"
}
]
}
]