violet-samples
is a list of example voice app/bot scripts (powered-by
violet-conversations). This
project is configured to create a skill at the einstein
end point.
Deploy | Script | Notes |
---|---|---|
scripts/basicCalculator.js | Basic Arithmetic Calculator | |
scripts/financeCalculator.js | Split bills, calculate tips & find out how many payments will need to be made on a mortgage | |
scripts/sf-leadsAndOpportunities.js | Access your Salesforce Sales Leads and Opportunities | |
scripts/sf-cases-employee.js | Access your Salesforce Service Cases (for employees) | |
scripts/sf-cases-customer.js | Access your Salesforce Service Cases (for customers) | |
scripts/sf-knowledge-base.js | Search a Salesforce Knowledge Base | |
apps/todo/script.js | Manage your todo list powered by Quip | |
scripts/diabetes-stoplight.js | Diabetes support at home for patients by implementing Stoplight tool | |
apps/restaurants/script.js | A sophisticated tool to help you find restaurants close by powered by the Yelp API | |
apps/dfSessions/script.js | An event information kiosk (built for Dreamforce) |
This project contains a number of Scripts that we have built and can be used as the basis of your Voice Application. To use the Scripts, they need to run in the cloud so that Amazon's voice servers can access it. These can also be run locally via a non-voice (web-only) interface.
-
Install Node v6 or greater - if you need to maintain an older version of node, consider using
nvm
. -
Get the code: If you want the latest fixes, we would recommend to get this via git:
git clone [email protected]:salesforce/violet-samples.git
. You can alternatively get the latest release. -
Download dependencies:
npm install
-
Environment variables: If you are using the Salesforce integration plugin (as used by the Leads & Opportunities Script) you will need to set up variables (for more information see the Persistence plugin information).
-
Run locally:
node <path_to_script>
(the script will print the path to the url for the web interface).You can also run the full server by doing:
npm start
but you will need to setup theSCRIPT_NAME
environment variable so that the engine knows which script to run (the default value is../scripts/sf-leadsAndOpportunities.js
).Local execution is used to ensure that there are no syntax errors, to view intent schemas (for the interaction model) and supported utterances, as well as for testing the script logic.
The code already has a Procfile
so it is easy to deploy to heroku
). When deploying make sure to configure the environment variables on the deployed server. Heroku lets you do this by typing something similar to (you will need to use the right values for XXX
):
heroku create
git push heroku master
heroku config:set SCRIPT_NAME=XXX V_SFDC_USERNAME=XXX V_SFDC_PASSWORD=XXX V_SFDC_CLIENT_ID=XXX V_SFDC_CLIENT_SECRET=XXX
Once deployed you will be able to use the web interface to register the skill on Amazon's or Google's services.
The code here has been setup to run with eslint
. It can be be run by doing:
npm run lint
- lints the scripts foldernpm run lint:watch
- watches changes in the script folder and runs lint on changenpm run lint:watch:changed
- similar to lint:watch but only lints on the file changed.
Guidelines on contributing to Violet are available here.