config.js - App Configuration

In this section, you will learn more about the essential configurations of a Jovo Voice App.

Overview

The config.js file in the src folder of a Jovo project is the place where all configuration of your voice app can be stored.

For example, the config.js for the "Hello World" Jovo project looks like this:

The above example shows three different elements:

Adding Configurations

There are several types of integrations that can be added to the config.js file:

General Configurations

Below are references to all the general configurations that can be added to the config.js file. The general configurations are added to the root element of the config object.

Category Name Description
Routing intentMap Maps incoming intents to specified intent names
intentsToSkipUnhandled Intents that should not be mapped to 'Unhandled' when not found in a certain state
inputMap Maps incoming input (slots and parameters) to specified input names
Data logging Logs both requests and responses
user Configure the Jovo User object
Output i18n Enable multilingual output for your voice app

Integrations

Jovo integrations are deeply integrated plugins that ususally implement an interface. Examples are:

Integration configurations are usually structured like this:

Learn more about Jovo integrations here.

Plugins

Plugin configurations can be added like this:

Accessing Configurations

If you want to access elements from your app config, you can do so by using the following object:

You can also define your own keys and values in the configuration file. For them to not interfere with Jovo config keys, we recommend using a wrapping element like custom:

You can then access them in your app logic with:

Staging

Jovo uses a structure similar to node-config to allow you to add config overrides for different stages.

For example, you could have several config files for different stages:

  • config.js: Default config of the project
  • config.qa.js: Config overrides for the QA environment (e.g. DynamoDB)
  • config.prod.js: Config overrides for the production environment (e.g. DynamoDB + Analytics)

For the app to discover what environment it is currently in, use NODE_ENV or STAGE as environment variables.

Here is how the db parts could differ for different environments:

When using expressJS for deploying your project, you should install the dotenv library to use staged config files:

and configure it inside your launch Intent:

For project-related staging environments, take a look at project.js.

Comments and Questions

Any specific questions? Just drop them below or join the Jovo Community Forum.

Join Our Newsletter

Be the first to get our free tutorials, courses, and other resources for voice app developers.