NAV

 Chatbot2000 Menu

javascript python shell ruby
   

Introduction

Welcome to the Chatbot2000 API! You can use our API to access Chatbot2000 API endpoints, which include the creation of chatbot, the modification of chatbot, the delete of chatbot and the converstation to chatbot.

We have language bindings in JavaScript, Python, Shell and Ruby! You can view code examples in the dark area on the right side of this page, and you can switch the programming language of the examples with the tabs on the top right of the page.

Authentication

To authorize, use this code in the request header:

   const token = 'YourAuthTokenHere'; const headers = { 'Authorization': `Bearer ${token}`, };   

Make sure to replace "YourAuthTokenHere" with your API key.

Chatbot2000 uses API keys to allow access to the API. You can get a new Chatbot2000 API key from your "dashboard" page.

Chatbot2000 expects for the API key to be included in all API requests to the server in a header that looks like the following:

token = "YourAuthTokenHere" "Authorization": f"Bearer {token}"

API key can be obtained in the "dashboard" menu as below.

API key image

chatbots

Create a chatbot

   const inputs = { chatbotName: 'demo', input_qas: [{'question':'question1','answer':'answer1'}, {'question':'question2', 'answer':'answer2'}], input_urls: ['https://www.example.com/introduction/1.html', 'https://www.example.com/introduction/2.html'], }; const token = 'YourAuthTokenHere'; const url = 'https://wwww.chatbot2000.com/api/chatbot_create/'; const headers = { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }; fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(inputs) }) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.error('There was a problem with the fetch operation:', error); });   

The above command returns JSON structured like this:

  { "chatbotId": "demoid" }  

This endpoint create a new chatbot.

HTTP Request

POST https://wwww.chatbot2000.com/api/chatbot_create/

Post Parameters

Parameter Default Description
chatbotName '' The name of the chatbot need to be created. For example:chatbotName: 'demo chat'
input_qas [] The Question and Answer the chatbot includes. For example: input_qas:[{'question':'question1','answer':'answer1'}, {'question':'question2', 'answer':'answer2'}]
input_urls [] The links of the chatbot need to be retrieved. For example: ['https://www.example.com/introduction/1.html', 'https://www.example.com/introduction/2.html']

Modify a chatbot

   const inputs = { chatbotId: 'demochatbotid', chatbotname: 'new name', input_urls: [ 'https://www.example.com/introduction/3.html', 'https://www.example.com/introduction/4.html' ], }; const url = 'https://wwww.chatbot2000.com/api/chatbot_modify/'; const token = 'YOUR_ACCESS_TOKEN'; // Replace with your actual Bearer token const headers = { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }; fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(inputs) }) .then(response => { if (response.ok) { return response.json(); } else { throw new Error('Failed to modify chatbot'); } }) .then(data => { console.log('Successfully modify chatbot with ID:', data.chatbotId); }) .catch(error => { console.error('Error:', error); });   

The above command returns JSON structured like this:

  { "chatbotId": "demoid" }  

This endpoint modifies a specific chatbot.

HTTP Request

POST https://wwww.chatbot2000.com/api/chatbot_modify

URL Parameters

Parameter Default Description
chatbotId '' The ID of the chatbot to be modified. For example: chatbotId:'demochatbotid'
chatbotName '' The name of the chatbot need to be renamed. For example:chatbotname: 'new name'
input_urls [] The links of the chatbot need to be retrieved. For example: ['https://www.example.com/introduction/3.html', 'https://www.example.com/introduction/4.html']

The "chatbotId" can be obtained at the "Chatbot Settings" tab in the "My Chatbot List" menu as below.

API key image

Delete a Specific chatbot

   const inputs = { chatbotId: 'demochatbotid', }; const url = 'https://wwww.chatbot2000.com/api/chatbot_delete/'; const token = 'YOUR_ACCESS_TOKEN'; // Replace with your actual Bearer token const headers = { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }; fetch(url, { method: 'DELETE', headers: headers, body: JSON.stringify(inputs) }) .then(response => { if (response.ok) { return response.json(); } else { throw new Error('Failed to delete chatbot'); } }) .then(data => { console.log('Successfully deleted the chatbot' ); }) .catch(error => { console.error('Error:', error); });   

The above command returns JSON structured like this:

  { "message": "The chatbot has been deleted successfully" }  

This endpoint deletes a specific chatbot.

HTTP Request

POST https://wwww.chatbot2000.com/api/chatbot_modify

URL Parameters

Parameter Default Description
chatbotId '' The ID of the chatbot to be deleted. For example: chatbotId:'demochatbotid'

Communicate with a chatbot

   const inputs = { chatbotId: 'demochatbotid', messages: [ {"role": "assistant", "content": "I am your customer assistant, what can I do for you today?" }, {"role": "user", "content": "how to create a chatbot in Chatbot2000?"}], sessionId: "demosessionid",} const url = 'https://wwww.chatbot2000.com/api/chatbot_talk/'; const token = 'YOUR_ACCESS_TOKEN'; // Replace with your actual Bearer token const headers = { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }; fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(inputs) }) .then(response => { if (response.ok) { return response.json(); } else { throw new Error('Failed to communicate to chatbot'); } }) .then(data => { console.log('Successfully communicated to chatbot:', data.answer); }) .catch(error => { console.error('Error:', error); });   

The above command returns JSON structured like this:

  { "answer": "Based on the informa...th. Enjoy!" }  

This endpoint communicate with a specific chatbot.

HTTP Request

POST https://wwww.chatbot2000.com/api/chatbot_talk

URL Parameters

Parameter Default Description
chatbotId '' The ID of the chatbot to be communicate. For example: chatbotId:'demochatbotid'
sessionId '' The name of the chatbot need to be renamed. For example:sessionId: 'demosessionid'
messages [] The message generated to communicate with GPT. For example: messages: [ {"role": "assistant", "content": "I am your customer assistant, what can I do for you today?" }, {"role": "user", "content": "how to create a chatbot in Chatbot2000?"}]

Errors

The Chatbot2000 API uses the following error codes:

Error Code Meaning
400 Bad Request --invalid json.
401 Unauthorized -- Your API key is wrong.
404 Not Found -- The specified chatbot could not be found.
405 Method Error -- Method not allowed.
406 Request Error -- The request can not be fulfilled due to account limitation.
500 Other Error -- We had a problem with our server. Try again later.