This is the official JavaScript client for ChatBees, a powerful chat API service.
To install the package and its peerDependencies, use npm:
npm install @chatbees/client axios
Here is an example of how to use the ChatClient of the package:
const { ChatClient } = require('@chatbees/client');
const client = new ChatClient('account_id');
// Add an event listener for historyChange
client.addEventListener('historyChange', () => {
console.log('Chat history has changed:', client.history);
});
client
.ask({
namespace_name: 'public',
collection_name: 'chatbees',
question: 'What is the weather today?',
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});
ask(data)
: Sends a question to the ChatBees API.
To build the project, run:
npm run build
To run tests, use:
npm test
This project is licensed under the MIT License. See the LICENSE.md
file for details.