@oration/web
v0.2.0
Published
A JavaScript SDK for the Oration API
Downloads
24
Readme
@oration/web
@oration/web is a JavaScript SDK for interacting with the Oration API, designed for use in web applications.
Installation
Install the package using npm:
npm install @oration/web
Usage
To use the SDK, you need to import it in your JavaScript code:
import { Oration } from '@oration/web';
const oration = new Oration('apiKey', 'workspaceSlug', 'restURL', 'websocketURL');
// Start the conversation
oration.startConversation({
agentId: 'b15f9c09-bcb0-4e64-b87f-11be8a5fec0a',
conversationType: 'web',
});
// Send a message
oration.sendText('Hello, how are you?');
// Listen for events
oration.on('conversation-created', (conversation) => {
console.log('Conversation created', conversation);
});
oration.on('call-start', () => {
console.log('Call started');
});
oration.on('call-end', () => {
console.log('Call ended');
});
oration.on('message', (message) => {
console.log('Message received', message);
});
Documentation
For more information on how to use the SDK, please refer to the documentation.
Contributing
Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. If you want to contribute code, please open a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for more information.