Home › Documentation
Documentation
Installation
Violet is distributed on npm. Add it to a Node.js project with:
$ npm install violet-conversations --save
Your first script
A Violet app is a script that describes a conversation. You register goals, describe what the user might say, and resolve each turn with a response:
var violet = require('violet').script(); violet.respondTo({ expecting: ['Hello', 'Hi Violet'], resolve: (response) => { response.say('Hello! How can I help you today?'); } }); module.exports = violet;
Core concepts
- Conversation Flow. Define conversations with an HTML-inspired flow language — nested user decisions and voice-based ‘forms’.
- Goals. Describe what the conversation is trying to accomplish; Violet manages the state needed to fill each goal.
- Inputs & Outputs. The
InputMgrprocesses what the user says; theOutputMgrandResponsebuild what Violet says back. - Stores. Persist conversation data through pluggable store modules such as
violetStorePG(Postgres) andvioletStoreSF(Salesforce). - Local testing. Iterate on your scripts in a browser-based harness before deploying to a device.
Next steps
Browse the full API reference for every module and class, read the release notes to see how the engine has evolved, or grab the source on GitHub.