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:
require 'net/http' require 'json' # Set your input data 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' ] } # Set your Bearer token token = 'YourAuthTokenHere' # Set the URL url = URI.parse('https://wwww.chatbot2000.com/api/chatbot_create/') # Create the request request = Net::HTTP::Post.new(url.path, {'Authorization' => "Bearer #{token}", 'Content-Type' => 'application/json'}) request.body = inputs.to_json # Send the request and get the response response = Net::HTTP.start(url.host, url.port) do |http| http.request(request) end # Print the response puts response.body
#!/bin/bash # Set your input data 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"] }' # Set your Bearer token token='YourAuthTokenHere' # Set the URL url='https://wwww.chatbot2000.com/api/chatbot_create' # Make the POST request using curl curl -X POST -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d "$inputs" "$url"
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']
#!/bin/bash URL="https://wwww.chatbot2000.com/api/chatbot_modify/" TOKEN="YOUR_ACCESS_TOKEN" # Replace with your actual Bearer token DATA='{ "chatbotId": "demochatbotid", "chatbotname": "new name", "input_urls": [ "https://www.example.com/introduction/3.html", "https://www.example.com/introduction/4.html" ] }' RESPONSE=$(curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d "$DATA" $URL) if [ $? -eq 0 ]; then CHATBOT_ID=$(echo "$RESPONSE" | jq -r '.chatbotId') echo "Successfully modified chatbot with ID: $CHATBOT_ID" else echo "Failed to modify chatbot. Response: $RESPONSE" fi
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.
require 'net/http' require 'json' # Set your input data inputs = { chatbotId: 'demochatbotid', } # Set your Bearer token token = 'YourAuthTokenHere' # Set the URL url = URI.parse('https://wwww.chatbot2000.com/api/chatbot_delete/') # Create the request request = Net::HTTP::Delete.new(url.path, {'Authorization' => "Bearer #{token}", 'Content-Type' => 'application/json'}) request.body = inputs.to_json # Send the request and get the response response = Net::HTTP.start(url.host, url.port) do |http| http.request(request) end # Print the response puts response.body
#!/bin/bash URL="https://wwww.chatbot2000.com/api/chatbot_delete/" TOKEN="YOUR_ACCESS_TOKEN" # Replace with your actual Bearer token DATA='{ "chatbotId": "demochatbotid", }' RESPONSE=$(curl -X DELETE -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d "$DATA" $URL) if [ $? -eq 0 ]; then message=$(echo "$RESPONSE" | jq -r '.message') echo "Successfully deleted the chatbot " else echo "Failed to delete chatbot. Response: $RESPONSE" fi
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); });
import requests # Input data 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",} # Bearer token token = "YourAuthTokenHere" # API endpoint url = "https://wwww.chatbot2000.com/api/chatbot_talk/" # Headers headers = { "Authorization": f"Bearer {token}", "Content-Type": "application/json" } # Send POST request response = requests.post(url, json=inputs, headers=headers)
require 'net/http' require 'json' 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',} url = URI.parse('https://wwww.chatbot2000.com/api/chatbot_talk/') http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Post.new(url.path, { 'Authorization' => 'Bearer YOUR_ACCESS_TOKEN', 'Content-Type' => 'application/json' }) request.body = inputs.to_json response = http.request(request) if response.is_a?(Net::HTTPSuccess) data = JSON.parse(response.body) puts "Successfully communicated to chatbot with ID: #{data['answer']}" else puts "Failed to communicate to chatbot. Status code: #{response.code}" end
#!/bin/bash URL="https://wwww.chatbot2000.com/api/chatbot_talk/" TOKEN="YOUR_ACCESS_TOKEN" # Replace with your actual Bearer token "chatbotId": "demochatbotid", "sessionId": "demosessionid", DATA='{ "chatbotId": "demochatbotid", "sessionId": "demosessionid", "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?"}] }' RESPONSE=$(curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d "$DATA" $URL) if [ $? -eq 0 ]; then CHATBOT_ID=$(echo "$RESPONSE" | jq -r '.answer') echo "Successfully communicated to chatbot with ID: $answer" else echo "Failed to communicate to chatbot. Response: $RESPONSE" fi
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.