We just updated Jovo to v1.0, see the announcement here. As this is our biggest update ever with lots of improvements, it was necessary to make some changes that might break existing apps (only if you update the
jovo-framework package to v1.0!).
In this blogpost, we will show you how to update your old voice applications to Jovo 1.0.
Jovo is an open-source development framework for building voice apps that work on both Amazon Alexa and Google Assistant with only one code base. Take a look at the Jovo Framework Docs or our Voice App Courses to learn more.
Jovo v1.0 is finally here! With our biggest update ever, we completely reworked the project structure, fixed some of the pain points and made development with the Jovo Framework a lot more comfortable. To make it easier for you to adapt to the changes, we want to show you how to transfer your existing projects to the new version.
Here’s everything that needs to be changed:
appin the app logic (see app.js example)
With the new Jovo Language Model, we offer a better way for you to maintain language models for both Amazon Alexa and Dialogflow (for Google Assistant) locally. For this, we restructured how a Jovo App looks like, as you can see above. Take a look at the sample voice app here.
appcontent (app.js), language model files, and configuring the servers
i18ndirectly in the
appfolder. See the i18n docs for more info.
To convert your existing Jovo project to this new structure, it’s probably best to create a new project and paste the right elements into the app.js file.
To get started, please update to the newest version of the Jovo CLI. Take a look here for the full installation guide and feature list of the CLI.
To create a new Jovo project, use the following command:
This will create a new directory called “yourDirectory” and clone the Jovo sample voice app, which has the same folder structure you can see in the illustration above.
You can also specify the language you want to have your app in (with the default locale being
Let’s now transfer our existing app configuration and app logic into the newly created app.js file. As mentioned in the introduction, we need to do some tweaks to deal with some architectural changes of the Jovo Framework.
With the new project structure, the application’s logic was moved to a new file (
index.js is now only responsible for the execution of your code):
This is how the
app.js looks like now:
By looking at the document, there are a few things that are different compared to the old structure:
appinside the handler
The changes you want to make to the app’s configuration are now added at the beginning of
app.js using the constructor:
You can find more information about that here.
The app logic is now happening inside a method that looks like this:
Some big structural changes that make the Jovo Framework more robust require to use
this instead of the global
app object inside the handlers
To keep the
this context in your helper functions, you can do something like this:
Although the way to access inputs in the parameters where convenient, they came with limitations: They only returned the value of an input as a String, leaving out important information like synonyms. This is why we’re now returning an object, with the value being one of its elements:
Those are all the changes you need to do to your app configuration and logic. You can now either proceed to run your app and test if everything works, or make use of the new powerful Jovo CLI to convert your existing language model into a Jovo Language Model.
This has been the most requested feature for Jovo: a consolidated language model that can be used for both platforms Alexa and Dialogflow. The Language Model lives inside the models folder and is used with the CLI to convert platform specific files into a platforms folder:
For existing projects, you can use import the necessary files into the platforms folder. This functionality is currently limited to Alexa.
To import an Alexa Skill you have to first set up the ASK CLI and then use the Jovo CLI:
After that, the platforms folder should look like this:
After this, you can either keep doing updates to the platform files (and use the jovo deploy command to upload them), or convert them to a Jovo Language Model.
Jovo also offers the ability to convert the existing Alexa Interaction Model to the Jovo Language Model.
For this, use the following command:
This will update the files in the models folder, which you can then update and use to export into both Alexa and Dialogflow language models.
As a next step, initialize the platforms, you want to deploy your project to:
This will create a file app.json:
Learn more about the app.json file here. This file will be used to later grab the right information that is needed to create the platform specific language model files from the Jovo models folder.
This will create all the files you need. Finished!
You can now run the application with the following command:
This will return the following, and reveal another powerful addition to the Jovo tools:
To make it even easier for you to develop locally, you don’t need to rely on ngrok anymore to create a tunnel to your local development server.
The Jovo Webhook creates a unique link that you can use as an endpoint on both Amazon Alexa and Dialogflow for testing and debugging.
Get news and free voice develpment resources in your inbox. No spam.
No spam. You can find previous editions here.