Prerequisites

  1. ChatFly account to get access token.
  2. A development environment or tool for making HTTP requests, such as Curl or a programming language like Python.

Uploading Data Sources

Currently here Uploading Data Source for url.

API Endpoint

The API endpoint for uploading data sources to your chatbot is: https://backend.chatfly.co/api/chat/history/{bot_id}/{date_from}/{date_to}/{order}

Make sure to replace {bot_id}, {date_from}, {date_to}, {order} with the your bot information.

Request Params

To get list url, you need to send a GET request to the API endpoint with a params request. Here’s an example params request:

{
  "bot_id": "xxxx-xxxx-xxxx-xxxx",
  "date_from": "2023-01-01T00:00:00",
  "date_to": "2030-12-31T00:00:00",
  "order": "created_at.desc"
}
  • bot_id (string): ID of your bot
  • date_from (datetime): start date you want get conversation history
  • date_to (datetime): end date you want get conversation history
  • order: sort for your conversation history

Example Request

Here’re example command sto uploading data sources using the ChatFly API:

Replace token with your token access.

Response Body

Response examples like this:

[
  [
  {
    "bot_name": "Chatfly",
    "bot_id": "3f1dfb85-177c-4690-a24a-5eef24410601",
    "user_id": "868af88e-9b14-4f55-8124-8e9903a90048",
    "session_id": "f1576597-e64e-6096-c875-631fd1ceb1f2",
    "created_at": "2023-11-04T06:38:26.901921Z",
    "chat_history_response": [
      {
        "sender_type": "user",
        "content": "Hi"
      },
      {
        "sender_type": "assistant",
        "content": "Hello! How can I assist you today?"
      },
      {...
      },
      {...
      }
    ]
  }
]
]